From 331fd94c689f89fabbffc5ea646b8c6f4cca2c7a Mon Sep 17 00:00:00 2001 From: Julian Ladisch Date: Sun, 5 Nov 2023 19:47:33 +0100 Subject: [PATCH] Fix getOpeningDayDurationTest When the test execution happens in the time range 00:00-00:59 the test fails because hour 0 minus one hour yields hour 23. Fix: Hard-code the local time. --- .../domain/OverduePeriodCalculatorServiceTest.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/folio/circulation/domain/OverduePeriodCalculatorServiceTest.java b/src/test/java/org/folio/circulation/domain/OverduePeriodCalculatorServiceTest.java index f63e260b99..ddd82a1cc6 100644 --- a/src/test/java/org/folio/circulation/domain/OverduePeriodCalculatorServiceTest.java +++ b/src/test/java/org/folio/circulation/domain/OverduePeriodCalculatorServiceTest.java @@ -123,15 +123,13 @@ private static Object[] getOpeningDayDurationTestParameters() { createOpeningDay(true, LocalDate.parse("2020-04-09"), LONDON), createOpeningDay(false, LocalDate.parse("2020-04-10"), LONDON)); - LocalTime now = getLocalTime(); - List invalid = Arrays.asList( new OpeningDay( singletonList(new OpeningHour(null, null)), LocalDate.parse("2020-04-08"), false, true, UTC ), - new OpeningDay( - singletonList(new OpeningHour(now, now.minusHours(1))), LocalDate.parse("2020-04-09"), - false, true, UTC) + new OpeningDay( // startTime after endTime + singletonList(new OpeningHour(LocalTime.of(6, 0), LocalTime.of(5, 0))), + LocalDate.parse("2020-04-09"), false, true, UTC) ); List allDaysClosed = Arrays.asList(