Skip to content

Commit

Permalink
Fix to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
derTobsch committed Dec 26, 2024
1 parent d52ed9e commit ea8f4cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion jollyday-pojo-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.focus-shift</groupId>
<artifactId>jollyday</artifactId>
<version>0.28.0-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion jollyday-pojo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>de.focus-shift</groupId>
<artifactId>jollyday</artifactId>
<version>0.28.0-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
import org.junit.jupiter.api.Test;

import de.focus_shift.jollyday.core.HolidayManager;
import de.focus_shift.jollyday.core.HolidayType;
import de.focus_shift.jollyday.core.ManagerParameter;
import de.focus_shift.jollyday.core.ManagerParameters;
import de.focus_shift.jollyday.core.spi.Configuration;
import de.focus_shift.jollyday.core.spi.YearCycle;
import de.focus_shift.jollyday.pojo.PojoConfigurationService;
import de.focus_shift.jollyday.pojo.PojoFixed;

import static de.focus_shift.jollyday.core.HolidayType.OBSERVANCE;

class PojoConfigurationServiceTest {

@Test
Expand All @@ -24,16 +25,16 @@ void enhancePojoConfigurationServiceWithSpecialHoliday() {
ManagerParameter parameter = ManagerParameters.create("de");

HolidayManager holidayManager = HolidayManager.getInstance(parameter);
Assertions.assertFalse(holidayManager.isHoliday(LocalDate.of(2022, 03, 22)), "Precondition 22.3 should be no holiday");
Assertions.assertFalse(holidayManager.isHoliday(LocalDate.of(2022, 3, 22)), "Precondition 22.3 should be no holiday");

// add new holiday for 22.3 dynamically via code/api
Configuration configuration = javaConfigurationService.getConfiguration(parameter);
PojoFixed stgandulfholiday = new PojoFixed("St.Gandulf's Day", HolidayType.UNOFFICIAL_HOLIDAY, null, null, YearCycle.EVERY_YEAR, null, MonthDay.of(3, 22));
PojoFixed stgandulfholiday = new PojoFixed("St.Gandulf's Day", OBSERVANCE, null, null, YearCycle.EVERY_YEAR, null, MonthDay.of(3, 22));
configuration.holidays().fixed().add(stgandulfholiday);
HolidayManager.clearManagerCache(); // we have to clear the manager cache because otherwise the holidaymanager from above with old configuration would be reused.
HolidayManager.clearManagerCache(); // we have to clear the manager cache because otherwise the holiday manager from above with old configuration would be reused.

holidayManager = HolidayManager.getInstance(parameter);
Assertions.assertTrue(holidayManager.isHoliday(LocalDate.of(2022, 03, 22), HolidayType.UNOFFICIAL_HOLIDAY), "Ensure newly added holiday is recognized");
Assertions.assertTrue(holidayManager.isHoliday(LocalDate.of(2022, 3, 22), OBSERVANCE), "Ensure newly added holiday is recognized");

}
}
Expand Down

0 comments on commit ea8f4cf

Please sign in to comment.