< prev index next >
test/jdk/java/time/test/java/time/TestOffsetDateTime.java
Print this page
rev 55940 : [mq]: 8211990
*** 1,7 ****
/*
! * Copyright (c) 2012, 2013, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 58,68 ****
--- 58,70 ----
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package test.java.time;
import static org.testng.Assert.assertSame;
+ import static org.testng.Assert.assertEquals;
+ import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
*** 71,80 ****
--- 73,84 ----
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
* Test OffsetDateTime.
+ *
+ * @bug 8211990
*/
@Test
public class TestOffsetDateTime extends AbstractTest {
private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
*** 318,323 ****
--- 322,334 ----
OffsetDateTime base = OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30, 59), OFFSET_PONE);
OffsetDateTime test = base.minusNanos(0);
assertSame(test, base);
}
+ @Test
+ public void test_duration() {
+ OffsetDateTime start = OffsetDateTime.MAX
+ .withOffsetSameLocal(ZoneOffset.ofHours(-17));
+ OffsetDateTime end = OffsetDateTime.MAX;
+ assertEquals(Duration.between(start, end), Duration.ofHours(1));
+ }
}
< prev index next >