From 841326c579e6280015c0999b9a349fcb8298813d Mon Sep 17 00:00:00 2001 From: Tobias Schneider Date: Fri, 6 Dec 2024 09:19:55 +0100 Subject: [PATCH] tests: unify sut use for nz --- .../CalendarPartManagerParameterTest.java | 4 +--- .../jollyday/tests/country/HolidayNZTest.java | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/jollyday-core/src/test/java/de/focus_shift/jollyday/core/parameter/CalendarPartManagerParameterTest.java b/jollyday-core/src/test/java/de/focus_shift/jollyday/core/parameter/CalendarPartManagerParameterTest.java index 28a480e23..ee2485c53 100644 --- a/jollyday-core/src/test/java/de/focus_shift/jollyday/core/parameter/CalendarPartManagerParameterTest.java +++ b/jollyday-core/src/test/java/de/focus_shift/jollyday/core/parameter/CalendarPartManagerParameterTest.java @@ -45,9 +45,7 @@ void ensureToReturnCorrectClassNameWithCalendarPart() { properties.setProperty("manager.impl", "managerImplClassName"); properties.setProperty("manager.impl.de", "managerImplClassNameDE"); - final CalendarPartManagerParameter sut = new CalendarPartManagerParameter("de", properties); - - assertThat(sut.getManagerImplClassName()) + assertThat(new CalendarPartManagerParameter("de", properties).getManagerImplClassName()) .isEqualTo("managerImplClassNameDE"); } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayNZTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayNZTest.java index 029b5d242..4da21009a 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayNZTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayNZTest.java @@ -19,18 +19,16 @@ class HolidayNZTest extends AbstractCountryTestBase { - private static final String ISO_CODE = "nz"; - private static final Year YEAR = Year.of(2018); - - private final HolidayManager holidayManager = HolidayManager.getInstance(create(NEW_ZEALAND)); - @Test void testManagerNZStructure() { - validateCalendarData(ISO_CODE, YEAR); + validateCalendarData("nz", Year.of(2018)); } @Test void testSouthlandAnniversary2011() { + + final HolidayManager holidayManager = HolidayManager.getInstance(create(NEW_ZEALAND)); + // Monday closest to 17 January final LocalDate expected = LocalDate.of(2011, 1, 17); final Set holidays = holidayManager.getHolidays(Year.of(2011), "stl"); @@ -42,6 +40,9 @@ void testSouthlandAnniversary2011() { @Test void testSouthlandAnniversary2012() { + + final HolidayManager holidayManager = HolidayManager.getInstance(create(NEW_ZEALAND)); + // Easter Tuesday final LocalDate expected = LocalDate.of(2012, 4, 10); final Set holidays = holidayManager.getHolidays(Year.of(2012), "stl"); @@ -53,7 +54,7 @@ void testSouthlandAnniversary2012() { @Property void ensuresThatQueenElisabethIIMemorialDayIsNotConfiguredUntil2021(@ForAll @YearRange(max = 2021) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(ISO_CODE)); + final HolidayManager holidayManager = HolidayManager.getInstance(create(NEW_ZEALAND)); final Set holidays = holidayManager.getHolidays(year); assertThat(holidays) .isNotEmpty() @@ -62,7 +63,7 @@ void ensuresThatQueenElisabethIIMemorialDayIsNotConfiguredUntil2021(@ForAll @Yea @Property void ensuresThatQueenElisabethIIMemorialDayIsConfiguredIn2022(@ForAll @YearRange(min = 2022, max = 2022) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(ISO_CODE)); + final HolidayManager holidayManager = HolidayManager.getInstance(create(NEW_ZEALAND)); final Set holidays = holidayManager.getHolidays(year); assertThat(holidays) .isNotEmpty() @@ -71,7 +72,7 @@ void ensuresThatQueenElisabethIIMemorialDayIsConfiguredIn2022(@ForAll @YearRange @Property void ensuresThatQueenElisabethIIMemorialDayIsConfiguredSince2023(@ForAll @YearRange(min = 2023) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(ISO_CODE)); + final HolidayManager holidayManager = HolidayManager.getInstance(create(NEW_ZEALAND)); final Set holidays = holidayManager.getHolidays(year); assertThat(holidays) .isNotEmpty()