garydgregory commented on code in PR #725:
URL: https://github.com/apache/commons-lang/pull/725#discussion_r1829201406
##########
src/test/java/org/apache/commons/lang3/time/CalendarUtilsTest.java:
##########
@@ -128,5 +131,13 @@ public void testToZonedDateTime(final String id) {
final ZonedDateTime zdt1 = ZonedDateTime.of(1, 2, 3, 4, 5, 6, 0,
zoneId);
calendar.setTimeInMillis(zdt1.toInstant().toEpochMilli());
assertEquals(ZonedDateTime.ofInstant(zdt1.toInstant(),
calendar.getTimeZone().toZoneId()), new
CalendarUtils(calendar).toZonedDateTime());
+
+ @Test
Review Comment:
Hello @asgh
One of the reasons for confusion perhaps is that the test data does not look
right.
How did you get from `-27078001200000` to `LocalDate.of(1111,
Month.DECEMBER, 1)` when:
```
public void testToLocalDate() {
final Calendar calendar = new
GregorianCalendar(TimeZone.getTimeZone(TimeZones.GMT_ID));
calendar.setTimeInMillis(-27078001200000L);
assertEquals("1111-12-08T05:00:00Z",
calendar.toInstant().toString());
assertEquals(LocalDate.of(1111, Month.DECEMBER, 8), new
CalendarUtils(calendar).toLocalDate());
calendar.setTimeInMillis(1614700215000L);
assertEquals(LocalDate.of(2021, Month.MARCH, 2), new
CalendarUtils(calendar).toLocalDate());
}
```
?
See
[`CalendarUtilsTest.testToLocalDate()`](https://github.com/apache/commons-lang/blob/3a8293af2b8cdab191a0e7ca6e306e0a2ac1e9e8/src/test/java/org/apache/commons/lang3/time/CalendarUtilsTest.java#L100-L107).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]