diff --git a/engine/time/src/main/java/io/deephaven/time/calendar/BusinessCalendar.java b/engine/time/src/main/java/io/deephaven/time/calendar/BusinessCalendar.java index 139c1c86838..539c2b1b681 100644 --- a/engine/time/src/main/java/io/deephaven/time/calendar/BusinessCalendar.java +++ b/engine/time/src/main/java/io/deephaven/time/calendar/BusinessCalendar.java @@ -1214,14 +1214,16 @@ public LocalDate[] businessDates(final LocalDate start, final LocalDate end, fin * @throws InvalidDateException if the dates are not in the valid range * @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed */ - public LocalDate[] businessDates(final String start, final String end, final boolean startInclusive, + public String[] businessDates(final String start, final String end, final boolean startInclusive, final boolean endInclusive) { if (start == null || end == null) { return null; } - return businessDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, - endInclusive); + final LocalDate[] dates = + businessDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, + endInclusive); + return dates == null ? null : Arrays.stream(dates).map(DateTimeUtils::formatDate).toArray(String[]::new); } /** @@ -1287,7 +1289,7 @@ public LocalDate[] businessDates(final LocalDate start, final LocalDate end) { * @throws InvalidDateException if the dates are not in the valid range * @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed */ - public LocalDate[] businessDates(final String start, final String end) { + public String[] businessDates(final String start, final String end) { return businessDates(start, end, true, true); } @@ -1357,14 +1359,16 @@ public LocalDate[] nonBusinessDates(final LocalDate start, final LocalDate end, * @throws InvalidDateException if the dates are not in the valid range * @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed */ - public LocalDate[] nonBusinessDates(final String start, final String end, final boolean startInclusive, + public String[] nonBusinessDates(final String start, final String end, final boolean startInclusive, final boolean endInclusive) { if (start == null || end == null) { return null; } - return nonBusinessDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, - endInclusive); + final LocalDate[] dates = + nonBusinessDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, + endInclusive); + return dates == null ? null : Arrays.stream(dates).map(DateTimeUtils::formatDate).toArray(String[]::new); } /** @@ -1430,7 +1434,7 @@ public LocalDate[] nonBusinessDates(final LocalDate start, final LocalDate end) * @throws InvalidDateException if the dates are not in the valid range * @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed */ - public LocalDate[] nonBusinessDates(final String start, final String end) { + public String[] nonBusinessDates(final String start, final String end) { return nonBusinessDates(start, end, true, true); } @@ -1748,12 +1752,13 @@ public LocalDate plusBusinessDays(final LocalDate date, final int days) { * @throws InvalidDateException if the date is not in the valid range * @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed */ - public LocalDate plusBusinessDays(final String date, final int days) { + public String plusBusinessDays(final String date, final int days) { if (date == null || days == NULL_INT) { return null; } - return plusBusinessDays(DateTimeUtils.parseLocalDate(date), days); + final LocalDate d = plusBusinessDays(DateTimeUtils.parseLocalDate(date), days); + return d == null ? null : d.toString(); } /** @@ -1840,7 +1845,7 @@ public LocalDate minusBusinessDays(final LocalDate date, final int days) { * @throws InvalidDateException if the date is not in the valid range * @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed */ - public LocalDate minusBusinessDays(final String date, final int days) { + public String minusBusinessDays(final String date, final int days) { if (date == null || days == NULL_INT) { return null; } @@ -1939,12 +1944,13 @@ public LocalDate plusNonBusinessDays(final LocalDate date, final int days) { * @throws InvalidDateException if the date is not in the valid range * @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed */ - public LocalDate plusNonBusinessDays(final String date, final int days) { + public String plusNonBusinessDays(final String date, final int days) { if (date == null || days == NULL_INT) { return null; } - return this.plusNonBusinessDays(DateTimeUtils.parseLocalDate(date), days); + final LocalDate d = this.plusNonBusinessDays(DateTimeUtils.parseLocalDate(date), days); + return d == null ? null : d.toString(); } /** @@ -2034,7 +2040,7 @@ public LocalDate minusNonBusinessDays(final LocalDate date, final int days) { * @throws InvalidDateException if the date is not in the valid range * @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed */ - public LocalDate minusNonBusinessDays(final String date, final int days) { + public String minusNonBusinessDays(final String date, final int days) { if (date == null || days == NULL_INT) { return null; } diff --git a/engine/time/src/main/java/io/deephaven/time/calendar/Calendar.java b/engine/time/src/main/java/io/deephaven/time/calendar/Calendar.java index 6c59e4563a9..163dc25ced6 100644 --- a/engine/time/src/main/java/io/deephaven/time/calendar/Calendar.java +++ b/engine/time/src/main/java/io/deephaven/time/calendar/Calendar.java @@ -10,6 +10,7 @@ import java.time.*; import java.time.temporal.ChronoUnit; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import static io.deephaven.util.QueryConstants.NULL_INT; @@ -258,12 +259,13 @@ public LocalDate plusDays(final LocalDate date, final int days) { * {@link io.deephaven.util.QueryConstants#NULL_INT}. * @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed */ - public LocalDate plusDays(final String date, final int days) { + public String plusDays(final String date, final int days) { if (date == null || days == NULL_INT) { return null; } - return plusDays(DateTimeUtils.parseLocalDate(date), days); + final LocalDate d = plusDays(DateTimeUtils.parseLocalDate(date), days); + return d == null ? null : d.toString(); } /** @@ -339,12 +341,13 @@ public LocalDate minusDays(final LocalDate date, final int days) { * {@link io.deephaven.util.QueryConstants#NULL_INT}. * @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed */ - public LocalDate minusDays(final String date, final int days) { + public String minusDays(final String date, final int days) { if (date == null || days == NULL_INT) { return null; } - return minusDays(DateTimeUtils.parseLocalDate(date), days); + final LocalDate d = minusDays(DateTimeUtils.parseLocalDate(date), days); + return d == null ? null : d.toString(); } /** @@ -457,14 +460,16 @@ public LocalDate[] calendarDates(final LocalDate start, final LocalDate end, fin * @return dates between {@code start} and {@code end}, or {@code null} if any input is {@code null}. * @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed */ - public LocalDate[] calendarDates(final String start, final String end, final boolean startInclusive, + public String[] calendarDates(final String start, final String end, final boolean startInclusive, final boolean endInclusive) { if (start == null || end == null) { return null; } - return calendarDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, - endInclusive); + final LocalDate[] dates = + calendarDates(DateTimeUtils.parseLocalDate(start), DateTimeUtils.parseLocalDate(end), startInclusive, + endInclusive); + return dates == null ? null : Arrays.stream(dates).map(DateTimeUtils::formatDate).toArray(String[]::new); } /** @@ -528,7 +533,7 @@ public LocalDate[] calendarDates(final LocalDate start, final LocalDate end) { * any input is {@code null}. * @throws DateTimeUtils.DateTimeParseException if the string cannot be parsed */ - public LocalDate[] calendarDates(final String start, final String end) { + public String[] calendarDates(final String start, final String end) { return calendarDates(start, end, true, true); } diff --git a/engine/time/src/main/java/io/deephaven/time/calendar/StaticCalendarMethods.java b/engine/time/src/main/java/io/deephaven/time/calendar/StaticCalendarMethods.java index 247cc54fccc..e19361e904d 100644 --- a/engine/time/src/main/java/io/deephaven/time/calendar/StaticCalendarMethods.java +++ b/engine/time/src/main/java/io/deephaven/time/calendar/StaticCalendarMethods.java @@ -31,7 +31,7 @@ */ public class StaticCalendarMethods { /** @see io.deephaven.time.calendar.BusinessCalendar#businessDates(java.lang.String,java.lang.String) */ - public static java.time.LocalDate[] businessDates( java.lang.String start, java.lang.String end ) {return Calendars.calendar().businessDates( start, end );} + public static java.lang.String[] businessDates( java.lang.String start, java.lang.String end ) {return Calendars.calendar().businessDates( start, end );} /** @see io.deephaven.time.calendar.BusinessCalendar#businessDates(java.time.Instant,java.time.Instant) */ public static java.time.LocalDate[] businessDates( java.time.Instant start, java.time.Instant end ) {return Calendars.calendar().businessDates( start, end );} @@ -43,7 +43,7 @@ public class StaticCalendarMethods { public static java.time.LocalDate[] businessDates( java.time.ZonedDateTime start, java.time.ZonedDateTime end ) {return Calendars.calendar().businessDates( start, end );} /** @see io.deephaven.time.calendar.BusinessCalendar#businessDates(java.lang.String,java.lang.String,boolean,boolean) */ - public static java.time.LocalDate[] businessDates( java.lang.String start, java.lang.String end, boolean startInclusive, boolean endInclusive ) {return Calendars.calendar().businessDates( start, end, startInclusive, endInclusive );} + public static java.lang.String[] businessDates( java.lang.String start, java.lang.String end, boolean startInclusive, boolean endInclusive ) {return Calendars.calendar().businessDates( start, end, startInclusive, endInclusive );} /** @see io.deephaven.time.calendar.BusinessCalendar#businessDates(java.time.Instant,java.time.Instant,boolean,boolean) */ public static java.time.LocalDate[] businessDates( java.time.Instant start, java.time.Instant end, boolean startInclusive, boolean endInclusive ) {return Calendars.calendar().businessDates( start, end, startInclusive, endInclusive );} @@ -58,7 +58,7 @@ public class StaticCalendarMethods { public static java.time.LocalDate calendarDate( ) {return Calendars.calendar().calendarDate( );} /** @see io.deephaven.time.calendar.Calendar#calendarDates(java.lang.String,java.lang.String) */ - public static java.time.LocalDate[] calendarDates( java.lang.String start, java.lang.String end ) {return Calendars.calendar().calendarDates( start, end );} + public static java.lang.String[] calendarDates( java.lang.String start, java.lang.String end ) {return Calendars.calendar().calendarDates( start, end );} /** @see io.deephaven.time.calendar.Calendar#calendarDates(java.time.Instant,java.time.Instant) */ public static java.time.LocalDate[] calendarDates( java.time.Instant start, java.time.Instant end ) {return Calendars.calendar().calendarDates( start, end );} @@ -70,7 +70,7 @@ public class StaticCalendarMethods { public static java.time.LocalDate[] calendarDates( java.time.ZonedDateTime start, java.time.ZonedDateTime end ) {return Calendars.calendar().calendarDates( start, end );} /** @see io.deephaven.time.calendar.Calendar#calendarDates(java.lang.String,java.lang.String,boolean,boolean) */ - public static java.time.LocalDate[] calendarDates( java.lang.String start, java.lang.String end, boolean startInclusive, boolean endInclusive ) {return Calendars.calendar().calendarDates( start, end, startInclusive, endInclusive );} + public static java.lang.String[] calendarDates( java.lang.String start, java.lang.String end, boolean startInclusive, boolean endInclusive ) {return Calendars.calendar().calendarDates( start, end, startInclusive, endInclusive );} /** @see io.deephaven.time.calendar.Calendar#calendarDates(java.time.Instant,java.time.Instant,boolean,boolean) */ public static java.time.LocalDate[] calendarDates( java.time.Instant start, java.time.Instant end, boolean startInclusive, boolean endInclusive ) {return Calendars.calendar().calendarDates( start, end, startInclusive, endInclusive );} @@ -271,7 +271,7 @@ public class StaticCalendarMethods { public static boolean isLastBusinessDayOfYear( java.time.ZonedDateTime time ) {return Calendars.calendar().isLastBusinessDayOfYear( time );} /** @see io.deephaven.time.calendar.BusinessCalendar#minusBusinessDays(java.lang.String,int) */ - public static java.time.LocalDate minusBusinessDays( java.lang.String date, int days ) {return Calendars.calendar().minusBusinessDays( date, days );} + public static java.lang.String minusBusinessDays( java.lang.String date, int days ) {return Calendars.calendar().minusBusinessDays( date, days );} /** @see io.deephaven.time.calendar.BusinessCalendar#minusBusinessDays(java.time.Instant,int) */ public static java.time.Instant minusBusinessDays( java.time.Instant time, int days ) {return Calendars.calendar().minusBusinessDays( time, days );} @@ -283,7 +283,7 @@ public class StaticCalendarMethods { public static java.time.ZonedDateTime minusBusinessDays( java.time.ZonedDateTime time, int days ) {return Calendars.calendar().minusBusinessDays( time, days );} /** @see io.deephaven.time.calendar.Calendar#minusDays(java.lang.String,int) */ - public static java.time.LocalDate minusDays( java.lang.String date, int days ) {return Calendars.calendar().minusDays( date, days );} + public static java.lang.String minusDays( java.lang.String date, int days ) {return Calendars.calendar().minusDays( date, days );} /** @see io.deephaven.time.calendar.Calendar#minusDays(java.time.Instant,int) */ public static java.time.Instant minusDays( java.time.Instant time, int days ) {return Calendars.calendar().minusDays( time, days );} @@ -295,7 +295,7 @@ public class StaticCalendarMethods { public static java.time.ZonedDateTime minusDays( java.time.ZonedDateTime time, int days ) {return Calendars.calendar().minusDays( time, days );} /** @see io.deephaven.time.calendar.BusinessCalendar#minusNonBusinessDays(java.lang.String,int) */ - public static java.time.LocalDate minusNonBusinessDays( java.lang.String date, int days ) {return Calendars.calendar().minusNonBusinessDays( date, days );} + public static java.lang.String minusNonBusinessDays( java.lang.String date, int days ) {return Calendars.calendar().minusNonBusinessDays( date, days );} /** @see io.deephaven.time.calendar.BusinessCalendar#minusNonBusinessDays(java.time.Instant,int) */ public static java.time.Instant minusNonBusinessDays( java.time.Instant time, int days ) {return Calendars.calendar().minusNonBusinessDays( time, days );} @@ -307,7 +307,7 @@ public class StaticCalendarMethods { public static java.time.ZonedDateTime minusNonBusinessDays( java.time.ZonedDateTime time, int days ) {return Calendars.calendar().minusNonBusinessDays( time, days );} /** @see io.deephaven.time.calendar.BusinessCalendar#nonBusinessDates(java.lang.String,java.lang.String) */ - public static java.time.LocalDate[] nonBusinessDates( java.lang.String start, java.lang.String end ) {return Calendars.calendar().nonBusinessDates( start, end );} + public static java.lang.String[] nonBusinessDates( java.lang.String start, java.lang.String end ) {return Calendars.calendar().nonBusinessDates( start, end );} /** @see io.deephaven.time.calendar.BusinessCalendar#nonBusinessDates(java.time.Instant,java.time.Instant) */ public static java.time.LocalDate[] nonBusinessDates( java.time.Instant start, java.time.Instant end ) {return Calendars.calendar().nonBusinessDates( start, end );} @@ -319,7 +319,7 @@ public class StaticCalendarMethods { public static java.time.LocalDate[] nonBusinessDates( java.time.ZonedDateTime start, java.time.ZonedDateTime end ) {return Calendars.calendar().nonBusinessDates( start, end );} /** @see io.deephaven.time.calendar.BusinessCalendar#nonBusinessDates(java.lang.String,java.lang.String,boolean,boolean) */ - public static java.time.LocalDate[] nonBusinessDates( java.lang.String start, java.lang.String end, boolean startInclusive, boolean endInclusive ) {return Calendars.calendar().nonBusinessDates( start, end, startInclusive, endInclusive );} + public static java.lang.String[] nonBusinessDates( java.lang.String start, java.lang.String end, boolean startInclusive, boolean endInclusive ) {return Calendars.calendar().nonBusinessDates( start, end, startInclusive, endInclusive );} /** @see io.deephaven.time.calendar.BusinessCalendar#nonBusinessDates(java.time.Instant,java.time.Instant,boolean,boolean) */ public static java.time.LocalDate[] nonBusinessDates( java.time.Instant start, java.time.Instant end, boolean startInclusive, boolean endInclusive ) {return Calendars.calendar().nonBusinessDates( start, end, startInclusive, endInclusive );} @@ -412,7 +412,7 @@ public class StaticCalendarMethods { public static java.time.LocalDate pastNonBusinessDate( int days ) {return Calendars.calendar().pastNonBusinessDate( days );} /** @see io.deephaven.time.calendar.BusinessCalendar#plusBusinessDays(java.lang.String,int) */ - public static java.time.LocalDate plusBusinessDays( java.lang.String date, int days ) {return Calendars.calendar().plusBusinessDays( date, days );} + public static java.lang.String plusBusinessDays( java.lang.String date, int days ) {return Calendars.calendar().plusBusinessDays( date, days );} /** @see io.deephaven.time.calendar.BusinessCalendar#plusBusinessDays(java.time.Instant,int) */ public static java.time.Instant plusBusinessDays( java.time.Instant time, int days ) {return Calendars.calendar().plusBusinessDays( time, days );} @@ -424,7 +424,7 @@ public class StaticCalendarMethods { public static java.time.ZonedDateTime plusBusinessDays( java.time.ZonedDateTime time, int days ) {return Calendars.calendar().plusBusinessDays( time, days );} /** @see io.deephaven.time.calendar.Calendar#plusDays(java.lang.String,int) */ - public static java.time.LocalDate plusDays( java.lang.String date, int days ) {return Calendars.calendar().plusDays( date, days );} + public static java.lang.String plusDays( java.lang.String date, int days ) {return Calendars.calendar().plusDays( date, days );} /** @see io.deephaven.time.calendar.Calendar#plusDays(java.time.Instant,int) */ public static java.time.Instant plusDays( java.time.Instant time, int days ) {return Calendars.calendar().plusDays( time, days );} @@ -436,7 +436,7 @@ public class StaticCalendarMethods { public static java.time.ZonedDateTime plusDays( java.time.ZonedDateTime time, int days ) {return Calendars.calendar().plusDays( time, days );} /** @see io.deephaven.time.calendar.BusinessCalendar#plusNonBusinessDays(java.lang.String,int) */ - public static java.time.LocalDate plusNonBusinessDays( java.lang.String date, int days ) {return Calendars.calendar().plusNonBusinessDays( date, days );} + public static java.lang.String plusNonBusinessDays( java.lang.String date, int days ) {return Calendars.calendar().plusNonBusinessDays( date, days );} /** @see io.deephaven.time.calendar.BusinessCalendar#plusNonBusinessDays(java.time.Instant,int) */ public static java.time.Instant plusNonBusinessDays( java.time.Instant time, int days ) {return Calendars.calendar().plusNonBusinessDays( time, days );} diff --git a/engine/time/src/test/java/io/deephaven/time/calendar/TestBusinessCalendar.java b/engine/time/src/test/java/io/deephaven/time/calendar/TestBusinessCalendar.java index 7fd3041cfa9..92da0b7eacf 100644 --- a/engine/time/src/test/java/io/deephaven/time/calendar/TestBusinessCalendar.java +++ b/engine/time/src/test/java/io/deephaven/time/calendar/TestBusinessCalendar.java @@ -3,7 +3,6 @@ */ package io.deephaven.time.calendar; -import io.deephaven.base.verify.RequirementFailure; import io.deephaven.time.DateTimeUtils; import java.time.*; @@ -645,14 +644,17 @@ public void testBusinessDates() { }; assertEquals(bus, bCalendar.businessDates(start, end)); - assertEquals(bus, bCalendar.businessDates(start.toString(), end.toString())); + assertEquals(Arrays.stream(bus).map(DateTimeUtils::formatDate).toArray(String[]::new), + bCalendar.businessDates(start.toString(), end.toString())); assertEquals(bus, bCalendar.businessDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone))); assertEquals(bus, bCalendar.businessDates(start.atTime(1, 24).atZone(timeZone).toInstant(), end.atTime(1, 24).atZone(timeZone).toInstant())); assertEquals(Arrays.copyOfRange(bus, 0, bus.length - 1), bCalendar.businessDates(start, end, true, false)); - assertEquals(Arrays.copyOfRange(bus, 0, bus.length - 1), + assertEquals( + Arrays.stream(Arrays.copyOfRange(bus, 0, bus.length - 1)).map(DateTimeUtils::formatDate) + .toArray(String[]::new), bCalendar.businessDates(start.toString(), end.toString(), true, false)); assertEquals(Arrays.copyOfRange(bus, 0, bus.length - 1), bCalendar .businessDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone), true, false)); @@ -661,7 +663,9 @@ public void testBusinessDates() { end.atTime(1, 24).atZone(timeZone).toInstant(), true, false)); assertEquals(Arrays.copyOfRange(bus, 1, bus.length), bCalendar.businessDates(start, end, false, true)); - assertEquals(Arrays.copyOfRange(bus, 1, bus.length), + assertEquals( + Arrays.stream(Arrays.copyOfRange(bus, 1, bus.length)).map(DateTimeUtils::formatDate) + .toArray(String[]::new), bCalendar.businessDates(start.toString(), end.toString(), false, true)); assertEquals(Arrays.copyOfRange(bus, 1, bus.length), bCalendar .businessDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone), false, true)); @@ -670,7 +674,9 @@ public void testBusinessDates() { end.atTime(1, 24).atZone(timeZone).toInstant(), false, true)); assertEquals(Arrays.copyOfRange(bus, 1, bus.length - 1), bCalendar.businessDates(start, end, false, false)); - assertEquals(Arrays.copyOfRange(bus, 1, bus.length - 1), + assertEquals( + Arrays.stream(Arrays.copyOfRange(bus, 1, bus.length - 1)).map(DateTimeUtils::formatDate) + .toArray(String[]::new), bCalendar.businessDates(start.toString(), end.toString(), false, false)); assertEquals(Arrays.copyOfRange(bus, 1, bus.length - 1), bCalendar .businessDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone), false, false)); @@ -780,7 +786,8 @@ public void testNonBusinessDates() { // }; assertEquals(nonBus, bCalendar.nonBusinessDates(start, end)); - assertEquals(nonBus, bCalendar.nonBusinessDates(start.toString(), end.toString())); + assertEquals(Arrays.stream(nonBus).map(DateTimeUtils::formatDate).toArray(String[]::new), + bCalendar.nonBusinessDates(start.toString(), end.toString())); assertEquals(nonBus, bCalendar.nonBusinessDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone))); assertEquals(nonBus, bCalendar.nonBusinessDates(start.atTime(1, 24).atZone(timeZone).toInstant(), @@ -788,7 +795,9 @@ public void testNonBusinessDates() { assertEquals(Arrays.copyOfRange(nonBus, 0, nonBus.length - 1), bCalendar.nonBusinessDates(nonBus[0], nonBus[nonBus.length - 1], true, false)); - assertEquals(Arrays.copyOfRange(nonBus, 0, nonBus.length - 1), + assertEquals( + Arrays.stream(Arrays.copyOfRange(nonBus, 0, nonBus.length - 1)).map(DateTimeUtils::formatDate) + .toArray(String[]::new), bCalendar.nonBusinessDates(nonBus[0].toString(), nonBus[nonBus.length - 1].toString(), true, false)); assertEquals(Arrays.copyOfRange(nonBus, 0, nonBus.length - 1), bCalendar.nonBusinessDates(nonBus[0].atTime(1, 24).atZone(timeZone), @@ -799,7 +808,9 @@ public void testNonBusinessDates() { assertEquals(Arrays.copyOfRange(nonBus, 1, nonBus.length), bCalendar.nonBusinessDates(nonBus[0], nonBus[nonBus.length - 1], false, true)); - assertEquals(Arrays.copyOfRange(nonBus, 1, nonBus.length), + assertEquals( + Arrays.stream(Arrays.copyOfRange(nonBus, 1, nonBus.length)).map(DateTimeUtils::formatDate) + .toArray(String[]::new), bCalendar.nonBusinessDates(nonBus[0].toString(), nonBus[nonBus.length - 1].toString(), false, true)); assertEquals(Arrays.copyOfRange(nonBus, 1, nonBus.length), bCalendar.nonBusinessDates(nonBus[0].atTime(1, 24).atZone(timeZone), @@ -810,7 +821,9 @@ public void testNonBusinessDates() { assertEquals(Arrays.copyOfRange(nonBus, 1, nonBus.length - 1), bCalendar.nonBusinessDates(nonBus[0], nonBus[nonBus.length - 1], false, false)); - assertEquals(Arrays.copyOfRange(nonBus, 1, nonBus.length - 1), + assertEquals( + Arrays.stream(Arrays.copyOfRange(nonBus, 1, nonBus.length - 1)).map(DateTimeUtils::formatDate) + .toArray(String[]::new), bCalendar.nonBusinessDates(nonBus[0].toString(), nonBus[nonBus.length - 1].toString(), false, false)); assertEquals(Arrays.copyOfRange(nonBus, 1, nonBus.length - 1), bCalendar.nonBusinessDates(nonBus[0].atTime(1, 24).atZone(timeZone), @@ -1104,7 +1117,7 @@ public void testPlusBusinessDays() { Instant i = z.toInstant(); assertEquals(d, bCalendar.plusBusinessDays(d, 0)); - assertEquals(d, bCalendar.plusBusinessDays(s, 0)); + assertEquals(d.toString(), bCalendar.plusBusinessDays(s, 0)); assertEquals(z.withZoneSameInstant(timeZone), bCalendar.plusBusinessDays(z, 0)); assertEquals(i, bCalendar.plusBusinessDays(i, 0)); @@ -1112,7 +1125,7 @@ public void testPlusBusinessDays() { final Instant i2 = d2.atTime(6, 24).atZone(timeZone2).toInstant(); final ZonedDateTime z2 = d2.atTime(6, 24).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d2, bCalendar.plusBusinessDays(d, 1)); - assertEquals(d2, bCalendar.plusBusinessDays(s, 1)); + assertEquals(d2.toString(), bCalendar.plusBusinessDays(s, 1)); assertEquals(z2, bCalendar.plusBusinessDays(z, 1)); assertEquals(i2, bCalendar.plusBusinessDays(i, 1)); @@ -1120,7 +1133,7 @@ public void testPlusBusinessDays() { final Instant i3 = d3.atTime(6, 24).atZone(timeZone2).toInstant(); final ZonedDateTime z3 = d3.atTime(6, 24).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d3, bCalendar.plusBusinessDays(d, 2)); - assertEquals(d3, bCalendar.plusBusinessDays(s, 2)); + assertEquals(d3.toString(), bCalendar.plusBusinessDays(s, 2)); assertEquals(z3, bCalendar.plusBusinessDays(z, 2)); assertEquals(i3, bCalendar.plusBusinessDays(i, 2)); @@ -1128,7 +1141,7 @@ public void testPlusBusinessDays() { final Instant i4 = d4.atTime(6, 24).atZone(timeZone2).toInstant(); final ZonedDateTime z4 = d4.atTime(6, 24).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d4, bCalendar.plusBusinessDays(d, 7)); - assertEquals(d4, bCalendar.plusBusinessDays(s, 7)); + assertEquals(d4.toString(), bCalendar.plusBusinessDays(s, 7)); assertEquals(z4, bCalendar.plusBusinessDays(z, 7)); assertEquals(i4, bCalendar.plusBusinessDays(i, 7)); @@ -1138,7 +1151,7 @@ public void testPlusBusinessDays() { i = z.toInstant(); assertEquals(d, bCalendar.plusBusinessDays(d, 0)); - assertEquals(d, bCalendar.plusBusinessDays(s, 0)); + assertEquals(d.toString(), bCalendar.plusBusinessDays(s, 0)); assertEquals(z.withZoneSameInstant(timeZone), bCalendar.plusBusinessDays(z, 0)); assertEquals(i, bCalendar.plusBusinessDays(i, 0)); @@ -1146,7 +1159,7 @@ public void testPlusBusinessDays() { final Instant i5 = d5.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z5 = d5.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d5, bCalendar.plusBusinessDays(d, -1)); - assertEquals(d5, bCalendar.plusBusinessDays(s, -1)); + assertEquals(d5.toString(), bCalendar.plusBusinessDays(s, -1)); assertEquals(z5, bCalendar.plusBusinessDays(z, -1)); assertEquals(i5, bCalendar.plusBusinessDays(i, -1)); @@ -1154,7 +1167,7 @@ public void testPlusBusinessDays() { final Instant i6 = d6.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z6 = d6.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d6, bCalendar.plusBusinessDays(d, -2)); - assertEquals(d6, bCalendar.plusBusinessDays(s, -2)); + assertEquals(d6.toString(), bCalendar.plusBusinessDays(s, -2)); assertEquals(z6, bCalendar.plusBusinessDays(z, -2)); assertEquals(i6, bCalendar.plusBusinessDays(i, -2)); @@ -1162,7 +1175,7 @@ public void testPlusBusinessDays() { final Instant i7 = d7.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z7 = d7.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d7, bCalendar.plusBusinessDays(d, -7)); - assertEquals(d7, bCalendar.plusBusinessDays(s, -7)); + assertEquals(d7.toString(), bCalendar.plusBusinessDays(s, -7)); assertEquals(z7, bCalendar.plusBusinessDays(z, -7)); assertEquals(i7, bCalendar.plusBusinessDays(i, -7)); @@ -1209,7 +1222,7 @@ public void testMinusBusinessDays() { Instant i = z.toInstant(); assertEquals(d, bCalendar.minusBusinessDays(d, 0)); - assertEquals(d, bCalendar.minusBusinessDays(s, 0)); + assertEquals(d.toString(), bCalendar.minusBusinessDays(s, 0)); assertEquals(z.withZoneSameInstant(timeZone), bCalendar.minusBusinessDays(z, 0)); assertEquals(i, bCalendar.minusBusinessDays(i, 0)); @@ -1217,7 +1230,7 @@ public void testMinusBusinessDays() { final Instant i1 = d1.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z1 = d1.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d1, bCalendar.minusBusinessDays(d, -1)); - assertEquals(d1, bCalendar.minusBusinessDays(s, -1)); + assertEquals(d1.toString(), bCalendar.minusBusinessDays(s, -1)); assertEquals(z1, bCalendar.minusBusinessDays(z, -1)); assertEquals(i1, bCalendar.minusBusinessDays(i, -1)); @@ -1225,7 +1238,7 @@ public void testMinusBusinessDays() { final Instant i2 = d2.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z2 = d2.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d2, bCalendar.minusBusinessDays(d, -2)); - assertEquals(d2, bCalendar.minusBusinessDays(s, -2)); + assertEquals(d2.toString(), bCalendar.minusBusinessDays(s, -2)); assertEquals(z2, bCalendar.minusBusinessDays(z, -2)); assertEquals(i2, bCalendar.minusBusinessDays(i, -2)); @@ -1233,7 +1246,7 @@ public void testMinusBusinessDays() { final Instant i3 = d3.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z3 = d3.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d3, bCalendar.minusBusinessDays(d, -7)); - assertEquals(d3, bCalendar.minusBusinessDays(s, -7)); + assertEquals(d3.toString(), bCalendar.minusBusinessDays(s, -7)); assertEquals(z3, bCalendar.minusBusinessDays(z, -7)); assertEquals(i3, bCalendar.minusBusinessDays(i, -7)); @@ -1243,7 +1256,7 @@ public void testMinusBusinessDays() { i = z.toInstant(); assertEquals(d, bCalendar.minusBusinessDays(d, 0)); - assertEquals(d, bCalendar.minusBusinessDays(s, 0)); + assertEquals(d.toString(), bCalendar.minusBusinessDays(s, 0)); assertEquals(z.withZoneSameInstant(timeZone), bCalendar.minusBusinessDays(z, 0)); assertEquals(i, bCalendar.minusBusinessDays(i, 0)); @@ -1251,7 +1264,7 @@ public void testMinusBusinessDays() { final Instant i4 = d4.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z4 = d4.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d4, bCalendar.minusBusinessDays(d, 1)); - assertEquals(d4, bCalendar.minusBusinessDays(s, 1)); + assertEquals(d4.toString(), bCalendar.minusBusinessDays(s, 1)); assertEquals(z4, bCalendar.minusBusinessDays(z, 1)); assertEquals(i4, bCalendar.minusBusinessDays(i, 1)); @@ -1259,7 +1272,7 @@ public void testMinusBusinessDays() { final Instant i5 = d5.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z5 = d5.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d5, bCalendar.minusBusinessDays(d, 2)); - assertEquals(d5, bCalendar.minusBusinessDays(s, 2)); + assertEquals(d5.toString(), bCalendar.minusBusinessDays(s, 2)); assertEquals(z5, bCalendar.minusBusinessDays(z, 2)); assertEquals(i5, bCalendar.minusBusinessDays(i, 2)); @@ -1267,7 +1280,7 @@ public void testMinusBusinessDays() { final Instant i6 = d6.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z6 = d6.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d6, bCalendar.minusBusinessDays(d, 7)); - assertEquals(d6, bCalendar.minusBusinessDays(s, 7)); + assertEquals(d6.toString(), bCalendar.minusBusinessDays(s, 7)); assertEquals(z6, bCalendar.minusBusinessDays(z, 7)); assertEquals(i6, bCalendar.minusBusinessDays(i, 7)); @@ -1322,7 +1335,7 @@ public void testPlusNonBusinessDays() { final Instant i1 = d1.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z1 = d1.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d1, bCalendar.plusNonBusinessDays(d, 1)); - assertEquals(d1, bCalendar.plusNonBusinessDays(s, 1)); + assertEquals(d1.toString(), bCalendar.plusNonBusinessDays(s, 1)); assertEquals(z1, bCalendar.plusNonBusinessDays(z, 1)); assertEquals(i1, bCalendar.plusNonBusinessDays(i, 1)); @@ -1330,7 +1343,7 @@ public void testPlusNonBusinessDays() { final Instant i2 = d2.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z2 = d2.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d2, bCalendar.plusNonBusinessDays(d, 2)); - assertEquals(d2, bCalendar.plusNonBusinessDays(s, 2)); + assertEquals(d2.toString(), bCalendar.plusNonBusinessDays(s, 2)); assertEquals(z2, bCalendar.plusNonBusinessDays(z, 2)); assertEquals(i2, bCalendar.plusNonBusinessDays(i, 2)); @@ -1338,7 +1351,7 @@ public void testPlusNonBusinessDays() { final Instant i3 = d3.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z3 = d3.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d3, bCalendar.plusNonBusinessDays(d, 4)); - assertEquals(d3, bCalendar.plusNonBusinessDays(s, 4)); + assertEquals(d3.toString(), bCalendar.plusNonBusinessDays(s, 4)); assertEquals(z3, bCalendar.plusNonBusinessDays(z, 4)); assertEquals(i3, bCalendar.plusNonBusinessDays(i, 4)); @@ -1356,7 +1369,7 @@ public void testPlusNonBusinessDays() { final Instant i4 = d4.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z4 = d4.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d4, bCalendar.plusNonBusinessDays(d, -1)); - assertEquals(d4, bCalendar.plusNonBusinessDays(s, -1)); + assertEquals(d4.toString(), bCalendar.plusNonBusinessDays(s, -1)); assertEquals(z4, bCalendar.plusNonBusinessDays(z, -1)); assertEquals(i4, bCalendar.plusNonBusinessDays(i, -1)); @@ -1364,7 +1377,7 @@ public void testPlusNonBusinessDays() { final Instant i5 = d5.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z5 = d5.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d5, bCalendar.plusNonBusinessDays(d, -2)); - assertEquals(d5, bCalendar.plusNonBusinessDays(s, -2)); + assertEquals(d5.toString(), bCalendar.plusNonBusinessDays(s, -2)); assertEquals(z5, bCalendar.plusNonBusinessDays(z, -2)); assertEquals(i5, bCalendar.plusNonBusinessDays(i, -2)); @@ -1372,7 +1385,7 @@ public void testPlusNonBusinessDays() { final Instant i6 = d6.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z6 = d6.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d6, bCalendar.plusNonBusinessDays(d, -4)); - assertEquals(d6, bCalendar.plusNonBusinessDays(s, -4)); + assertEquals(d6.toString(), bCalendar.plusNonBusinessDays(s, -4)); assertEquals(z6, bCalendar.plusNonBusinessDays(z, -4)); assertEquals(i6, bCalendar.plusNonBusinessDays(i, -4)); @@ -1427,7 +1440,7 @@ public void testMinusNonBusinessDays() { final Instant i1 = d1.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z1 = d1.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d1, bCalendar.minusNonBusinessDays(d, -1)); - assertEquals(d1, bCalendar.minusNonBusinessDays(s, -1)); + assertEquals(d1.toString(), bCalendar.minusNonBusinessDays(s, -1)); assertEquals(z1, bCalendar.minusNonBusinessDays(z, -1)); assertEquals(i1, bCalendar.minusNonBusinessDays(i, -1)); @@ -1435,7 +1448,7 @@ public void testMinusNonBusinessDays() { final Instant i2 = d2.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z2 = d2.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d2, bCalendar.minusNonBusinessDays(d, -2)); - assertEquals(d2, bCalendar.minusNonBusinessDays(s, -2)); + assertEquals(d2.toString(), bCalendar.minusNonBusinessDays(s, -2)); assertEquals(z2, bCalendar.minusNonBusinessDays(z, -2)); assertEquals(i2, bCalendar.minusNonBusinessDays(i, -2)); @@ -1443,7 +1456,7 @@ public void testMinusNonBusinessDays() { final Instant i3 = d3.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z3 = d3.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d3, bCalendar.minusNonBusinessDays(d, -4)); - assertEquals(d3, bCalendar.minusNonBusinessDays(s, -4)); + assertEquals(d3.toString(), bCalendar.minusNonBusinessDays(s, -4)); assertEquals(z3, bCalendar.minusNonBusinessDays(z, -4)); assertEquals(i3, bCalendar.minusNonBusinessDays(i, -4)); @@ -1461,7 +1474,7 @@ public void testMinusNonBusinessDays() { final Instant i4 = d4.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z4 = d4.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d4, bCalendar.minusNonBusinessDays(d, 1)); - assertEquals(d4, bCalendar.minusNonBusinessDays(s, 1)); + assertEquals(d4.toString(), bCalendar.minusNonBusinessDays(s, 1)); assertEquals(z4, bCalendar.minusNonBusinessDays(z, 1)); assertEquals(i4, bCalendar.minusNonBusinessDays(i, 1)); @@ -1469,7 +1482,7 @@ public void testMinusNonBusinessDays() { final Instant i5 = d5.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z5 = d5.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d5, bCalendar.minusNonBusinessDays(d, 2)); - assertEquals(d5, bCalendar.minusNonBusinessDays(s, 2)); + assertEquals(d5.toString(), bCalendar.minusNonBusinessDays(s, 2)); assertEquals(z5, bCalendar.minusNonBusinessDays(z, 2)); assertEquals(i5, bCalendar.minusNonBusinessDays(i, 2)); @@ -1477,7 +1490,7 @@ public void testMinusNonBusinessDays() { final Instant i6 = d6.atTime(6, 25).atZone(timeZone2).toInstant(); final ZonedDateTime z6 = d6.atTime(6, 25).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d6, bCalendar.minusNonBusinessDays(d, 4)); - assertEquals(d6, bCalendar.minusNonBusinessDays(s, 4)); + assertEquals(d6.toString(), bCalendar.minusNonBusinessDays(s, 4)); assertEquals(z6, bCalendar.minusNonBusinessDays(z, 4)); assertEquals(i6, bCalendar.minusNonBusinessDays(i, 4)); diff --git a/engine/time/src/test/java/io/deephaven/time/calendar/TestCalendar.java b/engine/time/src/test/java/io/deephaven/time/calendar/TestCalendar.java index 4fbf1c76ee4..892f23baed6 100644 --- a/engine/time/src/test/java/io/deephaven/time/calendar/TestCalendar.java +++ b/engine/time/src/test/java/io/deephaven/time/calendar/TestCalendar.java @@ -62,7 +62,7 @@ public void testPlusDays() { final Instant i = d.atTime(1, 24).atZone(timeZone2).toInstant(); assertEquals(d, calendar.plusDays(d, 0)); - assertEquals(d, calendar.plusDays(s, 0)); + assertEquals(d.toString(), calendar.plusDays(s, 0)); assertEquals(z.withZoneSameInstant(timeZone), calendar.plusDays(z, 0)); assertEquals(i, calendar.plusDays(i, 0)); @@ -70,7 +70,7 @@ public void testPlusDays() { final Instant i2 = d2.atTime(1, 24).atZone(timeZone2).toInstant(); final ZonedDateTime z2 = d2.atTime(1, 24).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d2, calendar.plusDays(d, 2)); - assertEquals(d2, calendar.plusDays(s, 2)); + assertEquals(d2.toString(), calendar.plusDays(s, 2)); assertEquals(z2, calendar.plusDays(z, 2)); assertEquals(i2, calendar.plusDays(i, 2)); assertEquals(2 * DateTimeUtils.DAY, DateTimeUtils.minus(i2, i)); @@ -80,7 +80,7 @@ public void testPlusDays() { final Instant i3 = d3.atTime(1, 24).atZone(timeZone2).toInstant(); final ZonedDateTime z3 = d3.atTime(z.toLocalTime()).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d3, calendar.plusDays(d, -2)); - assertEquals(d3, calendar.plusDays(s, -2)); + assertEquals(d3.toString(), calendar.plusDays(s, -2)); assertEquals(z3, calendar.plusDays(z, -2)); assertEquals(i3, calendar.plusDays(i, -2)); assertEquals(-2 * DateTimeUtils.DAY, DateTimeUtils.minus(i3, i)); @@ -116,7 +116,7 @@ public void testMinusDays() { final Instant i = d.atTime(1, 24).atZone(timeZone2).toInstant(); assertEquals(d, calendar.minusDays(d, 0)); - assertEquals(d, calendar.minusDays(s, 0)); + assertEquals(d.toString(), calendar.minusDays(s, 0)); assertEquals(z.withZoneSameInstant(timeZone), calendar.minusDays(z, 0)); assertEquals(i, calendar.minusDays(i, 0)); @@ -124,7 +124,7 @@ public void testMinusDays() { final Instant i2 = d2.atTime(1, 24).atZone(timeZone2).toInstant(); final ZonedDateTime z2 = d2.atTime(1, 24).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d2, calendar.minusDays(d, 2)); - assertEquals(d2, calendar.minusDays(s, 2)); + assertEquals(d2.toString(), calendar.minusDays(s, 2)); assertEquals(z2, calendar.minusDays(z, 2)); assertEquals(i2, calendar.minusDays(i, 2)); @@ -132,7 +132,7 @@ public void testMinusDays() { final Instant i3 = d3.atTime(1, 24).atZone(timeZone2).toInstant(); final ZonedDateTime z3 = d3.atTime(z.toLocalTime()).atZone(timeZone2).withZoneSameInstant(timeZone); assertEquals(d3, calendar.minusDays(d, -2)); - assertEquals(d3, calendar.minusDays(s, -2)); + assertEquals(d3.toString(), calendar.minusDays(s, -2)); assertEquals(z3, calendar.minusDays(z, -2)); assertEquals(i3, calendar.minusDays(i, -2)); @@ -180,14 +180,15 @@ public void testCalendarDates() { final LocalDate end = LocalDate.of(2023, 2, 5); assertEquals(new LocalDate[] {start, middle, end}, calendar.calendarDates(start, end)); - assertEquals(new LocalDate[] {start, middle, end}, calendar.calendarDates(start.toString(), end.toString())); + assertEquals(new String[] {start.toString(), middle.toString(), end.toString()}, + calendar.calendarDates(start.toString(), end.toString())); assertEquals(new LocalDate[] {start, middle, end}, calendar.calendarDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone))); assertEquals(new LocalDate[] {start, middle, end}, calendar.calendarDates( start.atTime(1, 24).atZone(timeZone).toInstant(), end.atTime(1, 24).atZone(timeZone).toInstant())); assertEquals(new LocalDate[] {start, middle}, calendar.calendarDates(start, end, true, false)); - assertEquals(new LocalDate[] {start, middle}, + assertEquals(new String[] {start.toString(), middle.toString()}, calendar.calendarDates(start.toString(), end.toString(), true, false)); assertEquals(new LocalDate[] {start, middle}, calendar.calendarDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone), true, false)); @@ -196,7 +197,7 @@ public void testCalendarDates() { end.atTime(1, 24).atZone(timeZone).toInstant(), true, false)); assertEquals(new LocalDate[] {middle, end}, calendar.calendarDates(start, end, false, true)); - assertEquals(new LocalDate[] {middle, end}, + assertEquals(new String[] {middle.toString(), end.toString()}, calendar.calendarDates(start.toString(), end.toString(), false, true)); assertEquals(new LocalDate[] {middle, end}, calendar.calendarDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone), false, true)); @@ -205,7 +206,8 @@ public void testCalendarDates() { end.atTime(1, 24).atZone(timeZone).toInstant(), false, true)); assertEquals(new LocalDate[] {middle}, calendar.calendarDates(start, end, false, false)); - assertEquals(new LocalDate[] {middle}, calendar.calendarDates(start.toString(), end.toString(), false, false)); + assertEquals(new String[] {middle.toString()}, + calendar.calendarDates(start.toString(), end.toString(), false, false)); assertEquals(new LocalDate[] {middle}, calendar.calendarDates(start.atTime(1, 24).atZone(timeZone), end.atTime(1, 24).atZone(timeZone), false, false)); assertEquals(new LocalDate[] {middle}, calendar.calendarDates(start.atTime(1, 24).atZone(timeZone).toInstant(),