--- old/test/jdk/java/time/test/java/time/TestZonedDateTime.java 2019-08-09 16:18:49.000000000 -0700 +++ new/test/jdk/java/time/test/java/time/TestZonedDateTime.java 2019-08-09 16:18:48.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,12 +59,19 @@ */ package test.java.time; +import static org.testng.Assert.assertEquals; + +import java.time.Duration; +import java.time.LocalDateTime; import java.time.ZonedDateTime; +import java.time.ZoneId; import org.testng.annotations.Test; /** * Test ZonedDateTime. + * + * @bug 8211990 */ @Test public class TestZonedDateTime extends AbstractTest { @@ -74,4 +81,14 @@ assertImmutable(ZonedDateTime.class); } + @Test + public void test_duration() { + ZoneId tokyo = ZoneId.of("Asia/Tokyo"); + ZoneId sanJose = ZoneId.of("America/Los_Angeles"); + + ZonedDateTime end = ZonedDateTime.of(LocalDateTime.MAX, sanJose); + ZonedDateTime start = end.withZoneSameLocal(tokyo); + + assertEquals(Duration.between(start, end), Duration.ofHours(17)); + } }