From 815e8c7f7a71938da0427a77beb4ed98d400e3e5 Mon Sep 17 00:00:00 2001 From: gmunozfe Date: Mon, 30 Dec 2024 12:38:04 +0100 Subject: [PATCH] [Fix_3818] Wrong calculation in test rollCalendarAfterHolidays if day is near to end-of-year --- .../org/jbpm/process/core/timer/BusinessCalendarImplTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jbpm/jbpm-flow/src/test/java/org/jbpm/process/core/timer/BusinessCalendarImplTest.java b/jbpm/jbpm-flow/src/test/java/org/jbpm/process/core/timer/BusinessCalendarImplTest.java index e1038c8b394..4ce6c40efd6 100755 --- a/jbpm/jbpm-flow/src/test/java/org/jbpm/process/core/timer/BusinessCalendarImplTest.java +++ b/jbpm/jbpm-flow/src/test/java/org/jbpm/process/core/timer/BusinessCalendarImplTest.java @@ -233,8 +233,12 @@ void rollCalendarAfterHolidays() { List weekendDays = Collections.emptyList(); Calendar calendar = Calendar.getInstance(); int currentDayOfYear = calendar.get(Calendar.DAY_OF_YEAR); + int maxDaysInYear = calendar.getActualMaximum(Calendar.DAY_OF_YEAR); BusinessCalendarImpl.rollCalendarAfterHolidays(calendar, holidays, weekendDays, false); int expected = currentDayOfYear + holidayLeft + 1; + if (expected > maxDaysInYear) { + expected -= maxDaysInYear; + } assertThat(calendar.get(Calendar.DAY_OF_YEAR)).isEqualTo(expected); }