From 7774beb137a07b7a64e7e0497e188db30715b2e0 Mon Sep 17 00:00:00 2001 From: Tobias Schneider Date: Thu, 12 Dec 2024 00:27:35 +0100 Subject: [PATCH] WIP: first fluent checker tests --- .../jollyday/tests/CalendarChecker.java | 395 ++++++++++++++++++ .../jollyday/tests/CalendarCheckerApi.java | 70 ++++ .../jollyday/tests/HolidayChecker.java | 86 ---- .../jollyday/tests/country/HolidayADTest.java | 33 +- .../jollyday/tests/country/HolidayAETest.java | 31 +- .../jollyday/tests/country/HolidayALTest.java | 68 ++- .../jollyday/tests/country/HolidayATTest.java | 57 +-- .../jollyday/tests/country/HolidayBGTest.java | 69 ++- .../jollyday/tests/country/HolidayCHTest.java | 114 ++--- .../jollyday/tests/country/HolidayCUTest.java | 97 +---- .../jollyday/tests/country/HolidayCYTest.java | 181 ++------ .../jollyday/tests/country/HolidayCZTest.java | 163 ++------ .../jollyday/tests/country/HolidayDETest.java | 92 ++-- .../jollyday/tests/country/HolidayDKTest.java | 63 +-- .../jollyday/tests/country/HolidayEGTest.java | 107 +++-- .../jollyday/tests/country/HolidayFITest.java | 145 +------ .../jollyday/tests/country/HolidayFRTest.java | 31 +- .../jollyday/tests/country/HolidayGETest.java | 156 ++----- .../jollyday/tests/country/HolidayNLTest.java | 181 ++------ .../jollyday/tests/country/HolidaySETest.java | 30 +- .../holidays/Holidays_test_al_2010.xml | 21 - .../holidays/Holidays_test_bg_2010.xml | 23 - .../holidays/Holidays_test_de_2010.xml | 131 ------ .../holidays/Holidays_test_de_2022.xml | 137 ------ .../holidays/Holidays_test_de_2023.xml | 138 ------ .../holidays/Holidays_test_fi_2010.xml | 27 -- .../holidays/Holidays_test_fr_2010.xml | 66 --- .../holidays/Holidays_test_se_2016.xml | 24 -- 28 files changed, 1016 insertions(+), 1720 deletions(-) create mode 100644 jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarChecker.java create mode 100644 jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarCheckerApi.java delete mode 100644 jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/HolidayChecker.java delete mode 100644 jollyday-tests/src/test/resources/holidays/Holidays_test_al_2010.xml delete mode 100644 jollyday-tests/src/test/resources/holidays/Holidays_test_bg_2010.xml delete mode 100644 jollyday-tests/src/test/resources/holidays/Holidays_test_de_2010.xml delete mode 100644 jollyday-tests/src/test/resources/holidays/Holidays_test_de_2022.xml delete mode 100644 jollyday-tests/src/test/resources/holidays/Holidays_test_de_2023.xml delete mode 100644 jollyday-tests/src/test/resources/holidays/Holidays_test_fi_2010.xml delete mode 100644 jollyday-tests/src/test/resources/holidays/Holidays_test_fr_2010.xml delete mode 100644 jollyday-tests/src/test/resources/holidays/Holidays_test_se_2016.xml diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarChecker.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarChecker.java new file mode 100644 index 000000000..8bd4a7741 --- /dev/null +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarChecker.java @@ -0,0 +1,395 @@ +package de.focus_shift.jollyday.tests; + +import de.focus_shift.jollyday.core.Holiday; +import de.focus_shift.jollyday.core.HolidayCalendar; +import de.focus_shift.jollyday.core.HolidayManager; +import de.focus_shift.jollyday.core.HolidayType; +import net.jqwik.api.Arbitraries; +import net.jqwik.time.api.arbitraries.YearArbitrary; +import org.junit.jupiter.api.Assertions; + +import java.time.DayOfWeek; +import java.time.LocalDate; +import java.time.Month; +import java.time.Year; +import java.time.temporal.TemporalAdjusters; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.Set; + +import static de.focus_shift.jollyday.core.ManagerParameters.create; +import static de.focus_shift.jollyday.tests.CalendarChecker.Category.BY_DAY; +import static de.focus_shift.jollyday.tests.CalendarChecker.Category.BY_KEY; +import static org.assertj.core.api.Assertions.assertThat; + +public class CalendarChecker implements CalendarCheckerApi.Holiday, CalendarCheckerApi.Between, CalendarCheckerApi.Properties { + + enum Category { + BY_DAY, + BY_KEY + } + + public enum Adjuster { + NEXT, + PREVIOUS; + } + + private final HolidayCalendar calendar; + private String propertyKey; + private Month month; + private int day; + private HolidayType type; + private Category category; + private String[] subdivisions = new String[]{}; + private List validRanges = new ArrayList<>(); + private List invalidRanges = new ArrayList<>(); + private List validShifts = new ArrayList<>(); + + private final List checks = new ArrayList<>(); + + public CalendarChecker(HolidayCalendar calendar) { + this.calendar = calendar; + } + + @Override + public CalendarCheckerApi.Properties hasChristianHoliday(final String propertyKey) { + return hasChristianHoliday(propertyKey, HolidayType.PUBLIC_HOLIDAY); + } + + @Override + public CalendarCheckerApi.Properties hasChristianHoliday(final String propertyKey, final HolidayType type) { + Objects.requireNonNull(propertyKey, "propertyKey is required"); + Objects.requireNonNull(type, "holiday type is required"); + + this.category = BY_KEY; + this.propertyKey = "christian." + propertyKey; + this.type = type; + + return this; + } + + @Override + public CalendarCheckerApi.Properties hasIslamicHoliday(final String propertyKey) { + return hasIslamicHoliday(propertyKey, HolidayType.PUBLIC_HOLIDAY); + } + + @Override + public CalendarCheckerApi.Properties hasIslamicHoliday(final String propertyKey, final HolidayType type) { + Objects.requireNonNull(propertyKey, "propertyKey is required"); + Objects.requireNonNull(type, "holiday type is required"); + + this.category = BY_KEY; + this.propertyKey = "islamic." + propertyKey; + this.type = type; + + return this; + } + + @Override + public CalendarCheckerApi.Properties hasFixedHoliday(final String propertyKey, final Month month, final int day) { + return hasFixedHoliday(propertyKey, month, day, HolidayType.PUBLIC_HOLIDAY); + } + + @Override + public CalendarCheckerApi.Properties hasFixedHoliday(final String propertyKey, final Month month, final int day, final HolidayType type) { + + Objects.requireNonNull(propertyKey, "propertyKey is required"); + Objects.requireNonNull(month, "month is required"); + if (day >= 32 || day <= 0) { + throw new IllegalArgumentException("day must be between 1 and 31"); + } + Objects.requireNonNull(type, "holiday type is required"); + + this.category = BY_DAY; + this.propertyKey = propertyKey; + this.month = month; + this.day = day; + this.type = type; + + return this; + } + + @Override + public CalendarCheckerApi.Properties between(final Year from, Year to) { + this.validRanges.add(new YearRange(from, to)); + return this; + } + + @Override + public CalendarCheckerApi.Properties notBetween(final Year from, Year to) { + this.invalidRanges.add(new YearRange(from, to)); + return this; + } + + @Override + public CalendarCheckerApi.Properties inSubdivision(String... subdivisions) { + this.subdivisions = subdivisions; + return this; + } + + @Override + public CalendarCheckerApi.Properties canBeenShiftedFrom(DayOfWeek from, DayOfWeek to) { + this.validShifts.add(new WeekDayFromTo(from, to, Adjuster.NEXT)); + return this; + } + + @Override + public CalendarCheckerApi.Properties canBeenShiftedFrom(DayOfWeek from, Adjuster adjuster, DayOfWeek to) { + this.validShifts.add(new WeekDayFromTo(from, to, adjuster)); + return this; + } + + @Override + public CalendarCheckerApi.Holiday and() { + checks.add(new HolidayCalendarCheck(this.calendar, this.propertyKey, this.month, this.day, this.type, this.validRanges, this.invalidRanges, this.validShifts, this.subdivisions, this.category)); + + clearProperties(); + + return this; + } + + private void clearProperties() { + this.propertyKey = null; + this.month = null; + this.day = 0; + this.type = null; + this.category = null; + this.subdivisions = new String[]{}; + this.validRanges = new ArrayList<>(); + this.invalidRanges = new ArrayList<>(); + this.validShifts = new ArrayList<>(); + } + + @Override + public void check() { + checks.add(new HolidayCalendarCheck(calendar, propertyKey, month, day, type, validRanges, invalidRanges, validShifts, subdivisions, category)); + + clearProperties(); + + for (HolidayCalendarCheck check : checks) { + switch (check.category) { + case BY_DAY: + checkByDate(check); + break; + case BY_KEY: + checkByKey(check); + break; + default: + throw new IllegalStateException("Unexpected value: " + check.category); + } + } + + this.checks.clear(); + } + + private void checkByDate(HolidayCalendarCheck check) { + final HolidayManager holidayManager = HolidayManager.getInstance(create(check.calendar)); + final YearArbitrary yearArbitrary = createYearArbitrary(); + + for (final YearRange invalidRange : check.getInvalidRanges()) { + yearArbitrary + .between(invalidRange.getFrom().getValue(), invalidRange.getTo().getValue()) + .forEachValue(year -> { + final Set holidays = holidayManager.getHolidays(year, check.getSubdivisions()); + + LocalDate date = LocalDate.of(year.getValue(), check.getMonth(), check.getDay()); + date = shiftLocalDate(check, date); + + assertThat(holidays) + .isNotEmpty() + .doesNotContain(new Holiday(date, check.getPropertiesKey(), check.getHolidayType())); + } + ); + } + + for (final YearRange validRange : check.getValidRanges()) { + yearArbitrary + .between(validRange.getFrom().getValue(), validRange.getTo().getValue()) + .forEachValue(year -> { + final Set holidays = holidayManager.getHolidays(year, check.getSubdivisions()); + + LocalDate date = LocalDate.of(year.getValue(), check.getMonth(), check.getDay()); + date = shiftLocalDate(check, date); + + assertThat(holidays) + .isNotEmpty() + .contains(new Holiday(date, check.getPropertiesKey(), check.getHolidayType())); + } + ); + } + } + + private static LocalDate shiftLocalDate(HolidayCalendarCheck check, LocalDate date) { + if (!check.validShifts.isEmpty()) { + for (WeekDayFromTo shift : check.validShifts) { + if (date.getDayOfWeek().equals(shift.getFrom())) { + if (shift.adjuster == Adjuster.NEXT) { + date = date.with(TemporalAdjusters.nextOrSame(shift.getTo())); + } else { + date = date.with(TemporalAdjusters.previousOrSame(shift.getTo())); + } + } + } + } + return date; + } + + private void checkByKey(HolidayCalendarCheck check) { + final HolidayManager holidayManager = HolidayManager.getInstance(create(check.calendar)); + final YearArbitrary yearArbitrary = createYearArbitrary(); + + for (final YearRange invalidRange : check.getInvalidRanges()) { + yearArbitrary + .between(invalidRange.getFrom().getValue(), invalidRange.getTo().getValue()) + .forEachValue(year -> { + final Set holidays = holidayManager.getHolidays(year, check.getSubdivisions()); + assertThat(holidays) + .isNotEmpty() + .filteredOn(holiday -> holiday.getPropertiesKey().equals(check.getPropertiesKey())) + .extracting(Holiday::getType) + .withFailMessage("Holiday '" + check.getPropertiesKey() + "' with holiday type '" + check.holidayType + "' in year '" + year + "' not found.") + .doesNotContain(check.getHolidayType()); + } + ); + } + + for (final YearRange validRange : check.getValidRanges()) { + yearArbitrary + .between(validRange.getFrom().getValue(), validRange.getTo().getValue()) + .forEachValue(year -> { + final Set holidays = holidayManager.getHolidays(year, check.getSubdivisions()); + assertThat(holidays) + .isNotEmpty() + .filteredOn(holiday -> holiday.getPropertiesKey().equals(check.getPropertiesKey())) + .extracting(Holiday::getType) + .withFailMessage("Holiday '" + check.getPropertiesKey() + "' with holiday type '" + check.holidayType + "' in year '" + year + "' not found.") + .contains(check.getHolidayType()); + } + ); + } + } + + private static YearArbitrary createYearArbitrary() { + return (YearArbitrary) Arbitraries.defaultFor(Year.class); + } + + private static final class HolidayCalendarCheck { + + private final HolidayCalendar calendar; + private final List validRanges; + private final List invalidRanges; + private final List validShifts; + private final Month month; + private final int day; + private final String propertiesKey; + private final HolidayType holidayType; + private final String[] subdivisions; + private final Category category; + + HolidayCalendarCheck(HolidayCalendar calendar, + String propertiesKey, Month month, int day, HolidayType holidayType, + List validRanges, List invalidRanges, + List validShifts, String[] subdivisions, Category category + ) { + this.calendar = calendar; + this.propertiesKey = propertiesKey; + this.month = month; + this.day = day; + this.holidayType = holidayType; + this.validRanges = validRanges.isEmpty() ? List.of(new YearRange(Year.of(1900), Year.of(2500))) : Collections.unmodifiableList(validRanges); + this.invalidRanges = Collections.unmodifiableList(invalidRanges); + this.validShifts = Collections.unmodifiableList(validShifts); + this.subdivisions = subdivisions; + this.category = category; + } + + public HolidayCalendar getCalendar() { + return calendar; + } + + public List getValidRanges() { + return validRanges; + } + + public List getInvalidRanges() { + return invalidRanges; + } + + public List getValidShifts() { + return validShifts; + } + + public Month getMonth() { + return month; + } + + public int getDay() { + return day; + } + + public String getPropertiesKey() { + return propertiesKey; + } + + public HolidayType getHolidayType() { + return holidayType; + } + + public String[] getSubdivisions() { + return subdivisions; + } + + public Category getCategory() { + return category; + } + } + + private static class YearRange { + + private final Year from; + private final Year to; + + YearRange(final Year from, final Year to) { + if (from != null && to != null) { + Assertions.assertFalse(from.isAfter(to), "To must be greater than or equal to the from year."); + } + this.from = from; + this.to = to; + } + + public Year getFrom() { + return from; + } + + public Year getTo() { + return to; + } + } + + private static class WeekDayFromTo { + + private final DayOfWeek from; + private final DayOfWeek to; + private final Adjuster adjuster; + + public WeekDayFromTo(final DayOfWeek from, final DayOfWeek to, final Adjuster adjuster) { + this.from = from; + this.to = to; + this.adjuster = adjuster; + } + + public DayOfWeek getFrom() { + return from; + } + + public DayOfWeek getTo() { + return to; + } + + public Adjuster getAdjuster() { + return adjuster; + } + } +} diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarCheckerApi.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarCheckerApi.java new file mode 100644 index 000000000..b4fda7277 --- /dev/null +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarCheckerApi.java @@ -0,0 +1,70 @@ +package de.focus_shift.jollyday.tests; + +import de.focus_shift.jollyday.core.HolidayCalendar; +import de.focus_shift.jollyday.core.HolidayType; +import de.focus_shift.jollyday.tests.CalendarChecker.Adjuster; + +import java.time.DayOfWeek; +import java.time.Month; +import java.time.Year; + +public interface CalendarCheckerApi { + + /** + * Creates a new instance of {@link CalendarChecker}. + *

+ * Calling multiple methods on the returned {@link CalendarChecker} is safe as it only interacts with the {@link CalendarCheckerApi} + *

+ * Examples: + *

 // you can chain multiple holiday checks
+   *     assertFor(GERMANY)
+   *       .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and()
+   *       .hasFixedHoliday("UNIFICATION", JUNE, 17)
+   *         .notBetween(Year.of(1900), Year.of(1953))
+   *         .between(Year.of(1954), Year.of(1990))
+   *         .notBetween(Year.of(1991), Year.of(2500))
+   *       .and()
+   *       .hasChristianHoliday("ASCENSION_DAY").and()
+   *       .hasChristianHoliday("WHIT_MONDAY")
+   *       .check();
+ * + * @param calendar the calendar that should be used for the holiday assertions + * @return the created holiday assertion object. + */ + static CalendarChecker assertFor(final HolidayCalendar calendar) { + return new CalendarChecker(calendar); + } + + interface Holiday { + Properties hasFixedHoliday(final String propertyKey, final Month month, final int day); + Properties hasFixedHoliday(final String propertyKey, final Month month, final int day, final HolidayType type); + + Properties hasChristianHoliday(final String propertyKey); + Properties hasChristianHoliday(final String propertyKey, final HolidayType type); + + Properties hasIslamicHoliday(final String propertyKey); + Properties hasIslamicHoliday(final String propertyKey, final HolidayType type); + } + + interface Properties extends Subdivision, Between, Shift, Check { + } + + interface Subdivision extends Check { + Properties inSubdivision(final String... subdivisions); + } + + interface Between extends Check { + Properties between(Year from, Year to); + Properties notBetween(Year from, Year to); + } + + interface Shift extends Check { + Properties canBeenShiftedFrom(DayOfWeek from, DayOfWeek to); + Properties canBeenShiftedFrom(DayOfWeek from, Adjuster adjuster, DayOfWeek to); + } + + interface Check { + Holiday and(); + void check(); + } +} diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/HolidayChecker.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/HolidayChecker.java deleted file mode 100644 index 8a685ae94..000000000 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/HolidayChecker.java +++ /dev/null @@ -1,86 +0,0 @@ -package de.focus_shift.jollyday.tests; - -import de.focus_shift.jollyday.core.Holiday; -import de.focus_shift.jollyday.core.HolidayCalendar; -import de.focus_shift.jollyday.core.HolidayManager; -import de.focus_shift.jollyday.core.HolidayType; -import net.jqwik.api.Arbitraries; -import net.jqwik.time.api.arbitraries.YearArbitrary; - -import java.time.LocalDate; -import java.time.Month; -import java.time.Year; -import java.util.Set; - -import static de.focus_shift.jollyday.core.HolidayType.PUBLIC_HOLIDAY; -import static de.focus_shift.jollyday.core.ManagerParameters.create; -import static org.assertj.core.api.Assertions.assertThat; - -public class HolidayChecker { - - public static final Year YEAR_FROM_DEFAULT = Year.of(1900); - public static final Year YEAR_TO_DEFAULT = Year.of(2500); - - public static void assertChristian(final HolidayCalendar calendar, final String propertiesKey) { - assertChristian(calendar, YEAR_FROM_DEFAULT, YEAR_TO_DEFAULT, propertiesKey, PUBLIC_HOLIDAY); - } - public static void assertChristian(final HolidayCalendar calendar, final Year from, final Year to, final String propertiesKey) { - assertChristian(calendar, from, to, propertiesKey, PUBLIC_HOLIDAY); - } - public static void assertChristian(final HolidayCalendar calendar, final Year from, final Year to, final String propertiesKey, final HolidayType holidayType) { - checkByKey(calendar, from, to, "christian." + propertiesKey, holidayType); - } - - public static void assertIslamic(final HolidayCalendar calendar, final String propertiesKey) { - assertIslamic(calendar, YEAR_FROM_DEFAULT, YEAR_TO_DEFAULT, propertiesKey, PUBLIC_HOLIDAY); - } - public static void assertIslamic(final HolidayCalendar calendar, final Year from, final Year to, final String propertiesKey) { - assertIslamic(calendar, from, to, propertiesKey, PUBLIC_HOLIDAY); - } - public static void assertIslamic(final HolidayCalendar calendar, final Year from, final Year to, final String propertiesKey, final HolidayType holidayType) { - checkByKey(calendar, from, to, "islamic." + propertiesKey, holidayType); - } - - - public static void assertFixed(final HolidayCalendar calendar, final Month month, final int day, final String propertiesKey) { - checkByDate(calendar, "", YEAR_FROM_DEFAULT, YEAR_TO_DEFAULT, month, day, propertiesKey, PUBLIC_HOLIDAY); - } - public static void assertFixed(final HolidayCalendar calendar, final String hierarchy, final Month month, final int day, final String propertiesKey) { - checkByDate(calendar, hierarchy, YEAR_FROM_DEFAULT, YEAR_TO_DEFAULT, month, day, propertiesKey, PUBLIC_HOLIDAY); - } - public static void assertFixed(final HolidayCalendar calendar, final Month month, final int day, final String propertiesKey, final HolidayType holidayType) { - checkByDate(calendar, "", YEAR_FROM_DEFAULT, YEAR_TO_DEFAULT, month, day, propertiesKey, holidayType); - } - public static void assertFixed(final HolidayCalendar calendar, final Year from, final Year to, final Month month, final int day, final String propertiesKey) { - checkByDate(calendar, "", from, to, month, day, propertiesKey, PUBLIC_HOLIDAY); - } - public static void assertFixed(final HolidayCalendar calendar, final Year from, final Year to , final Month month, final int day, final String propertiesKey, final HolidayType holidayType) { - checkByDate(calendar, "", from, to, month, day, propertiesKey, holidayType); - } - - private static void checkByKey(final HolidayCalendar calendar, final Year from, final Year to, final String propertiesKey, final HolidayType holidayType) { - ((YearArbitrary) Arbitraries.defaultFor(Year.class)) - .between(from.getValue(), to.getValue()) - .forEachValue(year -> { - final Set holidays = HolidayManager.getInstance(create(calendar)).getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .filteredOn(holiday -> holiday.getPropertiesKey().equals(propertiesKey)) - .extracting(Holiday::getType) - .contains(holidayType); - } - ); - } - - private static void checkByDate(final HolidayCalendar calendar, final String hierarchy, final Year from, final Year to, final Month month, final int day, final String propertiesKey, final HolidayType holidayType) { - ((YearArbitrary) Arbitraries.defaultFor(Year.class)) - .between(from.getValue(), to.getValue()) - .forEachValue(year -> { - final Set holidays = HolidayManager.getInstance(create(calendar)).getHolidays(year, hierarchy); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), month, day), propertiesKey, holidayType)); - } - ); - } -} diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayADTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayADTest.java index ddd758e13..209ec1d77 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayADTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayADTest.java @@ -3,8 +3,7 @@ import org.junit.jupiter.api.Test; import static de.focus_shift.jollyday.core.HolidayCalendar.ANDORRA; -import static de.focus_shift.jollyday.tests.HolidayChecker.assertChristian; -import static de.focus_shift.jollyday.tests.HolidayChecker.assertFixed; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; import static java.time.Month.AUGUST; import static java.time.Month.DECEMBER; import static java.time.Month.JANUARY; @@ -17,19 +16,21 @@ class HolidayADTest { @Test void ensuresHolidays() { - assertFixed(ANDORRA, JANUARY, 1, "NEW_YEAR"); - assertFixed(ANDORRA, JANUARY, 6, "EPIPHANY"); - assertFixed(ANDORRA, MARCH, 14, "CONSTITUTION_DAY"); - assertFixed(ANDORRA, MAY, 1, "LABOUR_DAY"); - assertFixed(ANDORRA, AUGUST, 15, "ASSUMPTION_DAY"); - assertFixed(ANDORRA, SEPTEMBER, 8, "NATIONAL_DAY"); - assertFixed(ANDORRA, NOVEMBER, 1, "ALL_SAINTS"); - assertFixed(ANDORRA, DECEMBER, 8, "IMMACULATE_CONCEPTION"); - assertFixed(ANDORRA, DECEMBER, 25, "CHRISTMAS"); - assertFixed(ANDORRA, DECEMBER, 26, "STEPHENS"); - assertChristian(ANDORRA, "CARNIVAL"); - assertChristian(ANDORRA, "GOOD_FRIDAY"); - assertChristian(ANDORRA, "EASTER_MONDAY"); - assertChristian(ANDORRA, "WHIT_MONDAY"); + assertFor(ANDORRA) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and() + .hasFixedHoliday("EPIPHANY", JANUARY, 6).and() + .hasFixedHoliday("CONSTITUTION_DAY", MARCH, 14).and() + .hasFixedHoliday("LABOUR_DAY", MAY, 1).and() + .hasFixedHoliday("ASSUMPTION_DAY", AUGUST, 15).and() + .hasFixedHoliday("NATIONAL_DAY", SEPTEMBER, 8).and() + .hasFixedHoliday("ALL_SAINTS", NOVEMBER, 1).and() + .hasFixedHoliday("IMMACULATE_CONCEPTION", DECEMBER, 8).and() + .hasFixedHoliday("CHRISTMAS", DECEMBER, 25).and() + .hasFixedHoliday("STEPHENS", DECEMBER, 26).and() + .hasChristianHoliday("CARNIVAL").and() + .hasChristianHoliday("GOOD_FRIDAY").and() + .hasChristianHoliday("EASTER_MONDAY").and() + .hasChristianHoliday("WHIT_MONDAY") + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayAETest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayAETest.java index 270b9864b..df288e470 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayAETest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayAETest.java @@ -5,8 +5,7 @@ import java.time.Year; import static de.focus_shift.jollyday.core.HolidayCalendar.UNITED_ARAB_EMIRATES; -import static de.focus_shift.jollyday.tests.HolidayChecker.assertFixed; -import static de.focus_shift.jollyday.tests.HolidayChecker.assertIslamic; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; import static java.time.Month.DECEMBER; import static java.time.Month.JANUARY; @@ -17,18 +16,20 @@ class HolidayAETest { @Test void ensuresHolidays() { - assertFixed(UNITED_ARAB_EMIRATES, YEAR_FROM, YEAR_TO, JANUARY, 1, "NEW_YEAR"); - assertFixed(UNITED_ARAB_EMIRATES, YEAR_FROM, YEAR_TO, DECEMBER, 1, "AE_COMMEMORATION_DAY"); - assertFixed(UNITED_ARAB_EMIRATES, YEAR_FROM, YEAR_TO, DECEMBER, 2, "NATIONAL_DAY"); - assertFixed(UNITED_ARAB_EMIRATES, YEAR_FROM, YEAR_TO, DECEMBER, 3, "NATIONAL_DAY"); - assertIslamic(UNITED_ARAB_EMIRATES, YEAR_FROM, YEAR_TO, "RAMADAN_END"); - assertIslamic(UNITED_ARAB_EMIRATES, YEAR_FROM, YEAR_TO, "ID_AL_FITR"); - assertIslamic(UNITED_ARAB_EMIRATES, YEAR_FROM, YEAR_TO, "ID_AL_FITR_2"); - assertIslamic(UNITED_ARAB_EMIRATES, YEAR_FROM, YEAR_TO, "ID_AL_FITR_3"); - assertIslamic(UNITED_ARAB_EMIRATES, YEAR_FROM, YEAR_TO, "ARAFAAT"); - assertIslamic(UNITED_ARAB_EMIRATES, YEAR_FROM, YEAR_TO, "ID_UL_ADHA"); - assertIslamic(UNITED_ARAB_EMIRATES, YEAR_FROM, YEAR_TO, "ID_UL_ADHA_2"); - assertIslamic(UNITED_ARAB_EMIRATES, YEAR_FROM, YEAR_TO, "ID_UL_ADHA_3"); - assertIslamic(UNITED_ARAB_EMIRATES, YEAR_FROM, YEAR_TO, "NEWYEAR"); + assertFor(UNITED_ARAB_EMIRATES) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1).between(YEAR_FROM, YEAR_TO).and() + .hasFixedHoliday("AE_COMMEMORATION_DAY", DECEMBER, 1).between(YEAR_FROM, YEAR_TO).and() + .hasFixedHoliday("NATIONAL_DAY", DECEMBER, 2).between(YEAR_FROM, YEAR_TO).and() + .hasFixedHoliday("NATIONAL_DAY", DECEMBER, 3).between(YEAR_FROM, YEAR_TO).and() + .hasIslamicHoliday("RAMADAN_END").between(YEAR_FROM, YEAR_TO).and() + .hasIslamicHoliday("ID_AL_FITR").between(YEAR_FROM, YEAR_TO).and() + .hasIslamicHoliday("ID_AL_FITR_2").between(YEAR_FROM, YEAR_TO).and() + .hasIslamicHoliday("ID_AL_FITR_3").between(YEAR_FROM, YEAR_TO).and() + .hasIslamicHoliday("ARAFAAT").between(YEAR_FROM, YEAR_TO).and() + .hasIslamicHoliday("ID_UL_ADHA").between(YEAR_FROM, YEAR_TO).and() + .hasIslamicHoliday("ID_UL_ADHA_2").between(YEAR_FROM, YEAR_TO).and() + .hasIslamicHoliday("ID_UL_ADHA_3").between(YEAR_FROM, YEAR_TO).and() + .hasIslamicHoliday("NEWYEAR").between(YEAR_FROM, YEAR_TO) + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayALTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayALTest.java index 8227ba0f4..c57436e8f 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayALTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayALTest.java @@ -4,13 +4,71 @@ import java.time.Year; -class HolidayALTest extends AbstractCountryTestBase { +import static de.focus_shift.jollyday.core.HolidayCalendar.ALBANIA; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; +import static java.time.DayOfWeek.MONDAY; +import static java.time.DayOfWeek.SATURDAY; +import static java.time.DayOfWeek.SUNDAY; +import static java.time.Month.DECEMBER; +import static java.time.Month.JANUARY; +import static java.time.Month.MARCH; +import static java.time.Month.MAY; +import static java.time.Month.NOVEMBER; +import static java.time.Month.OCTOBER; - private static final String ISO_CODE = "al"; - private static final Year YEAR = Year.of(2010); +class HolidayALTest { + + private static final Year YEAR_FROM = Year.of(1900); + private static final Year YEAR_TO = Year.of(2173); @Test - void testManagerALStructure() { - validateCalendarData(ISO_CODE, YEAR, true); + void ensuresHolidays() { + + assertFor(ALBANIA) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1) + .between(YEAR_FROM, YEAR_TO) + .canBeenShiftedFrom(SATURDAY, MONDAY) + .canBeenShiftedFrom(SUNDAY, MONDAY) + .and() + .hasFixedHoliday("NEW_YEAR", JANUARY, 1) + .between(YEAR_FROM, YEAR_TO) + .canBeenShiftedFrom(SATURDAY, MONDAY) + .canBeenShiftedFrom(SUNDAY, MONDAY) + .and() + .hasFixedHoliday("NEW_YEAR", JANUARY, 2) + .between(YEAR_FROM, YEAR_TO) + .canBeenShiftedFrom(SATURDAY, MONDAY) + .canBeenShiftedFrom(SUNDAY, MONDAY).and() + .hasFixedHoliday("SPRING_DAY", MARCH, 14) + .between(Year.of(2004), YEAR_TO) + .canBeenShiftedFrom(SATURDAY, MONDAY) + .canBeenShiftedFrom(SUNDAY, MONDAY).and() + .hasFixedHoliday("LABOUR_DAY", MAY, 1) + .between(YEAR_FROM, YEAR_TO) + .canBeenShiftedFrom(SATURDAY, MONDAY) + .canBeenShiftedFrom(SUNDAY, MONDAY).and() + .hasFixedHoliday("MOTHER_TERESA", OCTOBER, 19) + .between(Year.of(2003), YEAR_TO) + .canBeenShiftedFrom(SATURDAY, MONDAY) + .canBeenShiftedFrom(SUNDAY, MONDAY) + .and() + .hasFixedHoliday("INDEPENDENCE_DAY", NOVEMBER, 28) + .between(YEAR_FROM, YEAR_TO) + .and() + .hasFixedHoliday("LIBERATION", NOVEMBER, 29) + .between(YEAR_FROM, YEAR_TO) + .and() + .hasFixedHoliday("CHRISTMAS", DECEMBER, 25) + .between(YEAR_FROM, YEAR_TO) + .and() + .hasChristianHoliday("EASTER") + .between(YEAR_FROM, YEAR_TO).and() + .hasChristianHoliday("EASTER_MONDAY") + .between(YEAR_FROM, YEAR_TO).and() + .hasIslamicHoliday("ID_UL_ADHA") + .between(YEAR_FROM, YEAR_TO).and() + .hasIslamicHoliday("ID_AL_FITR") + .between(YEAR_FROM, YEAR_TO) + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayATTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayATTest.java index 1077b507f..060ba568b 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayATTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayATTest.java @@ -4,8 +4,7 @@ import static de.focus_shift.jollyday.core.HolidayCalendar.AUSTRIA; import static de.focus_shift.jollyday.core.HolidayType.OBSERVANCE; -import static de.focus_shift.jollyday.tests.HolidayChecker.assertChristian; -import static de.focus_shift.jollyday.tests.HolidayChecker.assertFixed; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; import static java.time.Month.AUGUST; import static java.time.Month.DECEMBER; import static java.time.Month.JANUARY; @@ -19,32 +18,34 @@ class HolidayATTest { @Test void ensuresHolidays() { - assertFixed(AUSTRIA, JANUARY, 1, "NEW_YEAR"); - assertFixed(AUSTRIA, JANUARY, 6, "EPIPHANY"); - assertFixed(AUSTRIA, MAY, 1, "LABOUR_DAY"); - assertFixed(AUSTRIA, AUGUST, 15, "ASSUMPTION_DAY"); - assertFixed(AUSTRIA, OCTOBER, 26, "NATIONAL_DAY"); - assertFixed(AUSTRIA, NOVEMBER, 1, "ALL_SAINTS"); - assertFixed(AUSTRIA, DECEMBER, 8, "IMMACULATE_CONCEPTION"); - assertFixed(AUSTRIA, DECEMBER, 24, "CHRISTMAS_EVE", OBSERVANCE); - assertFixed(AUSTRIA, DECEMBER, 25, "CHRISTMAS"); - assertFixed(AUSTRIA, DECEMBER, 26, "STEPHENS"); - assertFixed(AUSTRIA, DECEMBER, 31, "NEW_YEARS_EVE", OBSERVANCE); - assertChristian(AUSTRIA, "EASTER"); - assertChristian(AUSTRIA, "EASTER_MONDAY"); - assertChristian(AUSTRIA, "ASCENSION_DAY"); - assertChristian(AUSTRIA, "WHIT_MONDAY"); - assertChristian(AUSTRIA, "CORPUS_CHRISTI"); - assertFixed(AUSTRIA, "1", NOVEMBER, 11, "MARTINS_DAY"); - assertFixed(AUSTRIA, "2", MARCH, 19, "JOSEFS_DAY"); - assertFixed(AUSTRIA, "2", OCTOBER, 10, "PLEBISCITE"); - assertFixed(AUSTRIA, "3", NOVEMBER, 15, "LEOPOLD"); - assertFixed(AUSTRIA, "4", MAY, 4, "FLORIAN"); - assertFixed(AUSTRIA, "5", SEPTEMBER, 24, "RUPERT"); - assertFixed(AUSTRIA, "6", MARCH, 19, "JOSEFS_DAY"); - assertFixed(AUSTRIA, "7", MARCH, 19, "JOSEFS_DAY"); - assertFixed(AUSTRIA, "8", MARCH, 19, "JOSEFS_DAY"); - assertFixed(AUSTRIA, "9", NOVEMBER, 15, "LEOPOLD"); + assertFor(AUSTRIA) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and() + .hasFixedHoliday("EPIPHANY", JANUARY, 6).and() + .hasFixedHoliday("LABOUR_DAY", MAY, 1).and() + .hasFixedHoliday("ASSUMPTION_DAY", AUGUST, 15).and() + .hasFixedHoliday("NATIONAL_DAY", OCTOBER, 26).and() + .hasFixedHoliday("ALL_SAINTS", NOVEMBER, 1).and() + .hasFixedHoliday("IMMACULATE_CONCEPTION", DECEMBER, 8).and() + .hasFixedHoliday("CHRISTMAS_EVE", DECEMBER, 24, OBSERVANCE).and() + .hasFixedHoliday("CHRISTMAS", DECEMBER, 25).and() + .hasFixedHoliday("STEPHENS", DECEMBER, 26).and() + .hasFixedHoliday("NEW_YEARS_EVE", DECEMBER, 31, OBSERVANCE).and() + .hasChristianHoliday("EASTER").and() + .hasChristianHoliday("EASTER_MONDAY").and() + .hasChristianHoliday("ASCENSION_DAY").and() + .hasChristianHoliday("WHIT_MONDAY").and() + .hasChristianHoliday("CORPUS_CHRISTI").and() + .hasFixedHoliday("MARTINS_DAY", NOVEMBER, 11).inSubdivision("1").and() + .hasFixedHoliday("JOSEFS_DAY", MARCH, 19).inSubdivision("2").and() + .hasFixedHoliday("PLEBISCITE", OCTOBER, 10).inSubdivision("2").and() + .hasFixedHoliday("LEOPOLD", NOVEMBER, 15).inSubdivision("3").and() + .hasFixedHoliday("FLORIAN", MAY, 4).inSubdivision("4").and() + .hasFixedHoliday("RUPERT", SEPTEMBER, 24).inSubdivision("5").and() + .hasFixedHoliday("JOSEFS_DAY", MARCH, 19).inSubdivision("6").and() + .hasFixedHoliday("JOSEFS_DAY", MARCH, 19).inSubdivision("7").and() + .hasFixedHoliday("JOSEFS_DAY", MARCH, 19).inSubdivision("8").and() + .hasFixedHoliday("LEOPOLD", NOVEMBER, 15).inSubdivision("9") + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayBGTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayBGTest.java index 6f390a706..52d6ac2b2 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayBGTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayBGTest.java @@ -2,15 +2,70 @@ import org.junit.jupiter.api.Test; -import java.time.Year; +import static de.focus_shift.jollyday.core.HolidayCalendar.BULGARIA; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; +import static java.time.DayOfWeek.MONDAY; +import static java.time.DayOfWeek.SATURDAY; +import static java.time.DayOfWeek.SUNDAY; +import static java.time.DayOfWeek.TUESDAY; +import static java.time.DayOfWeek.WEDNESDAY; +import static java.time.Month.DECEMBER; +import static java.time.Month.JANUARY; +import static java.time.Month.MARCH; +import static java.time.Month.MAY; +import static java.time.Month.NOVEMBER; +import static java.time.Month.SEPTEMBER; -class HolidayBGTest extends AbstractCountryTestBase { - - private static final String ISO_CODE = "bg"; - private static final Year YEAR = Year.of(2010); +class HolidayBGTest { @Test - void testManagerBGStructure() { - validateCalendarData(ISO_CODE, YEAR); + void ensuresHolidays() { + assertFor(BULGARIA) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1) + .canBeenShiftedFrom(SATURDAY, MONDAY) + .canBeenShiftedFrom(SUNDAY, MONDAY) + .and() + .hasFixedHoliday("LIBERATION", MARCH, 3) + .canBeenShiftedFrom(SATURDAY, MONDAY) + .canBeenShiftedFrom(SUNDAY, MONDAY) + .and() + .hasFixedHoliday("LABOUR_DAY", MAY, 1) + .canBeenShiftedFrom(SATURDAY, MONDAY) + .canBeenShiftedFrom(SUNDAY, MONDAY) + .and() + .hasFixedHoliday("ST_GEORGE", MAY, 6) + .canBeenShiftedFrom(SATURDAY, MONDAY) + .canBeenShiftedFrom(SUNDAY, MONDAY) + .and() + .hasFixedHoliday("EDU_CULTURE", MAY, 24) + .canBeenShiftedFrom(SATURDAY, MONDAY) + .canBeenShiftedFrom(SUNDAY, MONDAY) + .and() + .hasFixedHoliday("UNIFICATION", SEPTEMBER, 6) + .canBeenShiftedFrom(SATURDAY, MONDAY) + .canBeenShiftedFrom(SUNDAY, MONDAY) + .and() + .hasFixedHoliday("INDEPENDENCE_DAY", SEPTEMBER, 22) + .canBeenShiftedFrom(SATURDAY, MONDAY) + .canBeenShiftedFrom(SUNDAY, MONDAY) + .and() + .hasFixedHoliday("NATIONAL_DAY", NOVEMBER, 1) + .canBeenShiftedFrom(SATURDAY, MONDAY) + .canBeenShiftedFrom(SUNDAY, MONDAY) + .and() + .hasFixedHoliday("CHRISTMAS_EVE", DECEMBER, 24) + .canBeenShiftedFrom(SUNDAY, WEDNESDAY) + .and() + .hasFixedHoliday("CHRISTMAS", DECEMBER, 25) + .canBeenShiftedFrom(SUNDAY, TUESDAY) + .and() + .hasFixedHoliday("SECOND_CHRISTMAS_DAY", DECEMBER, 26) + .canBeenShiftedFrom(SUNDAY, MONDAY) + .and() + .hasChristianHoliday("GOOD_FRIDAY").and() + .hasChristianHoliday("EASTER_SATURDAY").and() + .hasChristianHoliday("EASTER").and() + .hasChristianHoliday("EASTER_MONDAY") + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCHTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCHTest.java index 8e27c7f0c..ef6572f09 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCHTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCHTest.java @@ -1,85 +1,55 @@ package de.focus_shift.jollyday.tests.country; -import de.focus_shift.jollyday.core.Holiday; -import de.focus_shift.jollyday.core.HolidayManager; -import net.jqwik.api.ForAll; -import net.jqwik.api.Property; -import net.jqwik.time.api.constraints.YearRange; import org.junit.jupiter.api.Test; -import java.time.LocalDate; -import java.time.Year; -import java.util.Set; import static de.focus_shift.jollyday.core.HolidayCalendar.SWITZERLAND; -import static de.focus_shift.jollyday.core.HolidayType.OBSERVANCE; -import static de.focus_shift.jollyday.core.HolidayType.PUBLIC_HOLIDAY; -import static de.focus_shift.jollyday.core.ManagerParameters.create; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; +import static java.time.Month.AUGUST; import static java.time.Month.DECEMBER; -import static java.time.Month.JUNE; -import static java.time.Month.SEPTEMBER; -import static org.assertj.core.api.Assertions.assertThat; +import static java.time.Month.JANUARY; +import static java.time.Month.NOVEMBER; -class HolidayCHTest extends AbstractCountryTestBase { - private static final String ISO_CODE = "ch"; +class HolidayCHTest { @Test - void testManagerCHStructure() { - validateCalendarData(ISO_CODE, Year.of(2022), true); - } - - @Property - void ensuresThatStNicholasIsNotConfiguredInObwaldenUntil1946(@ForAll @YearRange(max = 1946) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(SWITZERLAND)); - final Set holidays = holidayManager.getHolidays(year, "ow"); - assertThat(holidays) - .isNotEmpty() - .doesNotContain(new Holiday(LocalDate.of(year.getValue(), SEPTEMBER, 25), "ST_NICHOLAS", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatStNicholasIsConfiguredInObwalden(@ForAll @YearRange(min = 1947) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(SWITZERLAND)); - final Set holidays = holidayManager.getHolidays(year, "ow"); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), SEPTEMBER, 25), "ST_NICHOLAS", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatStPeterAndPaulIsConfiguredInTicinoAsPublicHolidayUntil2020(@ForAll @YearRange(max = 2020) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(SWITZERLAND)); - final Set holidays = holidayManager.getHolidays(year, "ti"); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JUNE, 29), "ST_PETER_PAUL", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatStPeterAndPaulIsConfiguredInTicinoAsObservanceSince2021(@ForAll @YearRange(min = 2021) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(SWITZERLAND)); - final Set holidays = holidayManager.getHolidays(year, "ti"); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JUNE, 29), "ST_PETER_PAUL", OBSERVANCE)); - } - - @Property - void ensuresThatDayOfIndependenceIsConfiguredInJura(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(SWITZERLAND)); - final Set holidays = holidayManager.getHolidays(year, "ju"); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JUNE, 23), "INDEPENDENCE_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatRestorationOfTheRepublicIsConfiguredInGeneve(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(SWITZERLAND)); - final Set holidays = holidayManager.getHolidays(year, "ge"); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 31), "RESTORATION_OF_THE_REPUBLIC", PUBLIC_HOLIDAY)); + void ensuresHolidays() { + assertFor(SWITZERLAND) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and() + .hasFixedHoliday("NATIONAL_DAY", AUGUST, 1).and() + .hasFixedHoliday("CHRISTMAS", DECEMBER, 25).and() + .hasChristianHoliday("ASCENSION_DAY").and() + .hasChristianHoliday("EASTER").and() + + /* Aargau */ + .hasFixedHoliday("ST_BERCHTHOLD", JANUARY, 2) + .inSubdivision("ag") + .and() + .hasFixedHoliday("ASSUMPTION_DAY", AUGUST, 15) + .inSubdivision("ag") + .and() + .hasFixedHoliday("ALL_SAINTS", NOVEMBER, 1) + .inSubdivision("ag") + .and() + .hasFixedHoliday("STEPHENS", DECEMBER, 26) + .inSubdivision("ag") + .and() + .hasFixedHoliday("IMMACULATE_CONCEPTION", DECEMBER, 8) + .inSubdivision("ag") + .and() + .hasChristianHoliday("GOOD_FRIDAY") + .inSubdivision("ag") + .and() + .hasChristianHoliday("EASTER_MONDAY") + .inSubdivision("ag") + .and() + .hasChristianHoliday("WHIT_MONDAY") + .inSubdivision("ag") + .and() + .hasChristianHoliday("CORPUS_CHRISTI") + .inSubdivision("ag") + + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCUTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCUTest.java index 121b6d448..64a442e61 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCUTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCUTest.java @@ -1,92 +1,29 @@ package de.focus_shift.jollyday.tests.country; -import de.focus_shift.jollyday.core.Holiday; -import de.focus_shift.jollyday.core.HolidayManager; -import net.jqwik.api.ForAll; -import net.jqwik.api.Property; -import net.jqwik.time.api.constraints.YearRange; - -import java.time.LocalDate; -import java.time.Year; -import java.util.Set; +import org.junit.jupiter.api.Test; import static de.focus_shift.jollyday.core.HolidayCalendar.CUBA; -import static de.focus_shift.jollyday.core.HolidayCalendar.FINLAND; -import static de.focus_shift.jollyday.core.HolidayType.PUBLIC_HOLIDAY; -import static de.focus_shift.jollyday.core.ManagerParameters.create; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; import static java.time.Month.DECEMBER; import static java.time.Month.JANUARY; import static java.time.Month.JULY; import static java.time.Month.MAY; import static java.time.Month.OCTOBER; -import static org.assertj.core.api.Assertions.assertThat; - -class HolidayCUTest extends AbstractCountryTestBase { - - @Property - void ensuresThatTriumphOfTheRevolutionIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CUBA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 1), "TRIUMPH_OF_THE_REVOLUTION", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatVictoryOfFidelCastroIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CUBA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 2), "VICTORY_OF_FIDEL_CASTRO", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatLabourDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CUBA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), MAY, 1), "LABOUR_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatCommemorationOfTheAssaultOfTheMancadaGarrisonNotConfiguredBefore2016(@ForAll @YearRange(max = 2015) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CUBA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JULY, 25), "DAY_BEFORE_THE_COMMEMORATION_OF_THE_ASSAULT_OF_THE_MONCADA_GARRISON", PUBLIC_HOLIDAY)) - .contains(new Holiday(LocalDate.of(year.getValue(), JULY, 26), "COMMEMORATION_OF_THE_ASSAULT_OF_THE_MONCADA_GARRISON", PUBLIC_HOLIDAY)) - .contains(new Holiday(LocalDate.of(year.getValue(), JULY, 27), "DAY_AFTER_THE_COMMEMORATION_OF_THE_ASSAULT_OF_THE_MONCADA_GARRISON", PUBLIC_HOLIDAY)); - - } - - @Property - void ensuresThatIndependenceDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CUBA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), OCTOBER, 10), "INDEPENDENCE_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatChristmasIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CUBA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 25), "CHRISTMAS", PUBLIC_HOLIDAY)); - } - @Property - void ensuresThatGoodFridayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(FINLAND)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.GOOD_FRIDAY"); +class HolidayCUTest { + + @Test + void ensuresHolidays() { + assertFor(CUBA) + .hasFixedHoliday("TRIUMPH_OF_THE_REVOLUTION", JANUARY, 1).and() + .hasFixedHoliday("VICTORY_OF_FIDEL_CASTRO", JANUARY, 2).and() + .hasFixedHoliday("LABOUR_DAY", MAY, 1).and() + .hasFixedHoliday("DAY_BEFORE_THE_COMMEMORATION_OF_THE_ASSAULT_OF_THE_MONCADA_GARRISON", JULY, 25).and() + .hasFixedHoliday("COMMEMORATION_OF_THE_ASSAULT_OF_THE_MONCADA_GARRISON", JULY, 26).and() + .hasFixedHoliday("DAY_AFTER_THE_COMMEMORATION_OF_THE_ASSAULT_OF_THE_MONCADA_GARRISON", JULY, 27).and() + .hasFixedHoliday("INDEPENDENCE_DAY", OCTOBER, 10).and() + .hasFixedHoliday("CHRISTMAS", DECEMBER, 25).and() + .hasChristianHoliday("GOOD_FRIDAY") + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCYTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCYTest.java index b085aa5c0..b7cbab6af 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCYTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCYTest.java @@ -1,18 +1,9 @@ package de.focus_shift.jollyday.tests.country; -import de.focus_shift.jollyday.core.Holiday; -import de.focus_shift.jollyday.core.HolidayManager; -import net.jqwik.api.ForAll; -import net.jqwik.api.Property; -import net.jqwik.time.api.constraints.YearRange; - -import java.time.LocalDate; -import java.time.Year; -import java.util.Set; +import org.junit.jupiter.api.Test; import static de.focus_shift.jollyday.core.HolidayCalendar.CYPRUS; -import static de.focus_shift.jollyday.core.HolidayType.PUBLIC_HOLIDAY; -import static de.focus_shift.jollyday.core.ManagerParameters.create; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; import static java.time.Month.APRIL; import static java.time.Month.AUGUST; import static java.time.Month.DECEMBER; @@ -20,151 +11,29 @@ import static java.time.Month.MARCH; import static java.time.Month.MAY; import static java.time.Month.OCTOBER; -import static org.assertj.core.api.Assertions.assertThat; - -class HolidayCYTest extends AbstractCountryTestBase { - - @Property - void ensuresThatNewYearIsOnFirstJanuary(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 1), "NEW_YEAR", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatEpiphanyConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 6), "EPIPHANY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatGreekIndependenceDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), MARCH, 25), "GREEK_INDEPENDENCE_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatCyprusNationalDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), APRIL, 1), "CYPRUS_NATIONAL_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatLabourDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), MAY, 1), "LABOUR_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatVirginMaryIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), AUGUST, 15), "VIRGIN_MARY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatCyprusIndependenceDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), OCTOBER, 1), "CYPRUS_INDEPENDENCE_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatOchiIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), OCTOBER, 28), "OCHI", PUBLIC_HOLIDAY)); - } - - - @Property - void ensuresThatChristmasIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 24), "CHRISTMAS_EVE", PUBLIC_HOLIDAY)) - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 25), "CHRISTMAS", PUBLIC_HOLIDAY)) - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 26), "STEPHENS", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatCleanMondayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.CLEAN_MONDAY"); - } - - @Property - void ensuresThatGoodFridayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.GOOD_FRIDAY"); - } - - @Property - void ensuresThatEasterMondayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.EASTER_MONDAY"); - } - - @Property - void ensuresThatEasterTuesdayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.EASTER_TUESDAY"); - } - - @Property - void ensuresThatPentecostIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.PENTECOST"); - } - @Property - void ensuresThatWhitMondayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CYPRUS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.WHIT_MONDAY"); +class HolidayCYTest { + + @Test + void ensuresHolidays() { + assertFor(CYPRUS) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and() + .hasFixedHoliday("EPIPHANY", JANUARY, 6).and() + .hasFixedHoliday("GREEK_INDEPENDENCE_DAY", MARCH, 25).and() + .hasFixedHoliday("CYPRUS_NATIONAL_DAY", APRIL, 1).and() + .hasFixedHoliday("LABOUR_DAY", MAY, 1).and() + .hasFixedHoliday("VIRGIN_MARY", AUGUST, 15).and() + .hasFixedHoliday("CYPRUS_INDEPENDENCE_DAY", OCTOBER, 1).and() + .hasFixedHoliday("OCHI", OCTOBER, 28).and() + .hasFixedHoliday("CHRISTMAS_EVE", DECEMBER, 24).and() + .hasFixedHoliday("CHRISTMAS", DECEMBER, 25).and() + .hasFixedHoliday("STEPHENS", DECEMBER, 26).and() + .hasChristianHoliday("CLEAN_MONDAY").and() + .hasChristianHoliday("GOOD_FRIDAY").and() + .hasChristianHoliday("EASTER_MONDAY").and() + .hasChristianHoliday("EASTER_TUESDAY").and() + .hasChristianHoliday("PENTECOST").and() + .hasChristianHoliday("WHIT_MONDAY") + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCZTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCZTest.java index 636992855..4b4296598 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCZTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayCZTest.java @@ -1,18 +1,11 @@ package de.focus_shift.jollyday.tests.country; -import de.focus_shift.jollyday.core.Holiday; -import de.focus_shift.jollyday.core.HolidayManager; -import net.jqwik.api.ForAll; -import net.jqwik.api.Property; -import net.jqwik.time.api.constraints.YearRange; +import org.junit.jupiter.api.Test; -import java.time.LocalDate; import java.time.Year; -import java.util.Set; import static de.focus_shift.jollyday.core.HolidayCalendar.CZECH_REPUBLIC; -import static de.focus_shift.jollyday.core.HolidayType.PUBLIC_HOLIDAY; -import static de.focus_shift.jollyday.core.ManagerParameters.create; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; import static java.time.Month.DECEMBER; import static java.time.Month.JANUARY; import static java.time.Month.JULY; @@ -20,136 +13,28 @@ import static java.time.Month.NOVEMBER; import static java.time.Month.OCTOBER; import static java.time.Month.SEPTEMBER; -import static org.assertj.core.api.Assertions.assertThat; -class HolidayCZTest extends AbstractCountryTestBase { - - @Property - void ensuresThatNewYearConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 1), "NEW_YEAR", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatLabourDayConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), MAY, 1), "LABOUR_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatLiberationConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), MAY, 8), "LIBERATION", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatCyrusMethodiusConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JULY, 5), "CYRUS_METHODIUS", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatHusConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JULY, 6), "HUS", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatWencelasConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), SEPTEMBER, 28), "WENCELAS", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatIndependenceDayConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), OCTOBER, 28), "INDEPENDENCE_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatFreedomDemocracyConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), NOVEMBER, 17), "FREEDOM_DEMOCRACY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatChristmasEveConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 24), "CHRISTMAS_EVE", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatChristmasConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 25), "CHRISTMAS", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatStephensConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 26), "STEPHENS", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatGoodFridayIsConfiguredSince2016(@ForAll @YearRange(min = 2016) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.GOOD_FRIDAY"); - } - - @Property - void ensuresThatGoodFridayIsNotConfiguredUntil2015(@ForAll @YearRange(max = 2015) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .doesNotContain("christian.GOOD_FRIDAY"); - } - - @Property - void ensuresThatEasterMondaySince1942(@ForAll @YearRange(min = 1942) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.EASTER_MONDAY"); +class HolidayCZTest { + + @Test + void ensuresHolidays() { + assertFor(CZECH_REPUBLIC) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and() + .hasFixedHoliday("LABOUR_DAY", MAY, 1).and() + .hasFixedHoliday("LIBERATION", MAY, 8).and() + .hasFixedHoliday("CYRUS_METHODIUS", JULY, 5).and() + .hasFixedHoliday("HUS", JULY, 6).and() + .hasFixedHoliday("WENCELAS", SEPTEMBER, 28).and() + .hasFixedHoliday("INDEPENDENCE_DAY", OCTOBER, 28).and() + .hasFixedHoliday("FREEDOM_DEMOCRACY", NOVEMBER, 17).and() + .hasFixedHoliday("CHRISTMAS_EVE", DECEMBER, 24).and() + .hasFixedHoliday("CHRISTMAS", DECEMBER, 25).and() + .hasFixedHoliday("STEPHENS", DECEMBER, 26).and() + .hasChristianHoliday("GOOD_FRIDAY") + .between(Year.of(2016), Year.of(2500)) + .notBetween(Year.of(1900), Year.of(2015)) + .and() + .hasChristianHoliday("EASTER_MONDAY") + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayDETest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayDETest.java index 81860ed57..af5c8aa9d 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayDETest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayDETest.java @@ -1,72 +1,42 @@ package de.focus_shift.jollyday.tests.country; -import de.focus_shift.jollyday.core.Holiday; -import de.focus_shift.jollyday.core.HolidayCalendar; -import de.focus_shift.jollyday.core.HolidayManager; -import de.focus_shift.jollyday.core.ManagerParameter; -import de.focus_shift.jollyday.core.ManagerParameters; -import de.focus_shift.jollyday.core.util.CalendarUtil; import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import java.time.LocalDate; import java.time.Year; -import java.util.List; -import java.util.Locale; -import java.util.Set; -import static java.util.Locale.FRANCE; -import static java.util.Locale.GERMAN; -import static java.util.Locale.GERMANY; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.fail; +import static de.focus_shift.jollyday.core.HolidayCalendar.GERMANY; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; +import static java.time.Month.DECEMBER; +import static java.time.Month.JANUARY; +import static java.time.Month.JUNE; +import static java.time.Month.MAY; +import static java.time.Month.OCTOBER; -class HolidayDETest extends AbstractCountryTestBase { - - private static final String ISO_CODE = "de"; - - @ParameterizedTest - @ValueSource(strings = {"2010", "2022", "2023"}) - void testManagerDEStructure(final Year year) { - validateCalendarData(ISO_CODE, year, true); - } - - @Test - void testManagerDEInterval() { - try { - final HolidayManager instance = HolidayManager.getInstance(ManagerParameters.create(HolidayCalendar.GERMANY, null)); - final LocalDate startDateInclusive = LocalDate.of(2010, 10, 1); - final LocalDate endDateInclusive = LocalDate.of(2011, 1, 31); - final Set holidays = instance.getHolidays(startDateInclusive, endDateInclusive); - final List expected = List.of(LocalDate.of(2010, 12, 25), - LocalDate.of(2010, 12, 26), LocalDate.of(2010, 10, 3), - LocalDate.of(2011, 1, 1)); - assertThat(holidays).hasSameSizeAs(expected); - for (LocalDate d : expected) { - assertThat(CalendarUtil.contains(holidays, d)).isTrue(); - } - } catch (Exception e) { - fail("Unexpected error occurred: " + e.getClass().getName() + " - " + e.getMessage()); - } - } +class HolidayDETest { @Test - void testSystemLocaleInfluence() { - final Set french = getUsingSystemLocale(FRANCE); - final Set german = getUsingSystemLocale(GERMANY); - assertThat(german).isEqualTo(french); - } - - private Set getUsingSystemLocale(Locale systemLocale) { - final Locale defaultLocale = Locale.getDefault(); - try { - Locale.setDefault(systemLocale); - final ManagerParameter parameters = ManagerParameters.create(GERMAN); - final HolidayManager mgr = HolidayManager.getInstance(parameters); - return mgr.getHolidays(Year.of(2018)); - } finally { - Locale.setDefault(defaultLocale); - } + void ensuresHolidays() { + assertFor(GERMANY) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and() + .hasFixedHoliday("LABOUR_DAY", MAY, 1).and() + .hasFixedHoliday("UNIFICATION", JUNE, 17) + .notBetween(Year.of(1900), Year.of(1953)) + .between(Year.of(1954), Year.of(1990)) + .notBetween(Year.of(1991), Year.of(2500)) + .and() + .hasFixedHoliday("UNIFICATION_GERMANY", OCTOBER, 3) + .notBetween(Year.of(1900), Year.of(1989)) + .between(Year.of(1990), Year.of(2500)) + .and() + .hasFixedHoliday("REFORMATION_DAY", OCTOBER, 31) + .between(Year.of(2017), Year.of(2017)) + .and() + .hasFixedHoliday("FIRST_CHRISTMAS_DAY", DECEMBER, 25).and() + .hasFixedHoliday("SECOND_CHRISTMAS_DAY", DECEMBER, 26).and() + .hasChristianHoliday("GOOD_FRIDAY").and() + .hasChristianHoliday("EASTER_MONDAY").and() + .hasChristianHoliday("ASCENSION_DAY").and() + .hasChristianHoliday("WHIT_MONDAY") + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayDKTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayDKTest.java index df1817231..ec0bc5815 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayDKTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayDKTest.java @@ -1,58 +1,33 @@ package de.focus_shift.jollyday.tests.country; -import de.focus_shift.jollyday.core.Holiday; -import de.focus_shift.jollyday.core.HolidayManager; -import net.jqwik.api.ForAll; -import net.jqwik.api.Property; -import net.jqwik.time.api.constraints.YearRange; import org.junit.jupiter.api.Test; -import java.time.LocalDate; import java.time.Year; -import java.util.Set; import static de.focus_shift.jollyday.core.HolidayCalendar.DENMARK; -import static de.focus_shift.jollyday.core.HolidayType.PUBLIC_HOLIDAY; -import static de.focus_shift.jollyday.core.ManagerParameters.create; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; import static java.time.Month.DECEMBER; import static java.time.Month.JANUARY; -import static java.time.Month.MAY; -import static org.assertj.core.api.Assertions.assertThat; -class HolidayDKTest extends AbstractCountryTestBase { - - @Property - void ensuresThatNewYearIsOnFirstJanuary(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(DENMARK)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 1), "NEW_YEAR", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatFirstAndSecondChristmasIsCorrect(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(DENMARK)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 25), "CHRISTMAS", PUBLIC_HOLIDAY)) - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 26), "STEPHENS", PUBLIC_HOLIDAY)); - } +class HolidayDKTest { @Test - void ensuresThatGeneralPrayersDayIsOnlyUntil2023() { - final HolidayManager holidayManagerDK = HolidayManager.getInstance(create(DENMARK)); - - final Set holidays2023 = holidayManagerDK.getHolidays(Year.of(2023)); - assertThat(holidays2023) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(2023, MAY, 5), "christian.GENERAL_PRAYER_DAY", PUBLIC_HOLIDAY)); - - final Set holidays2024 = holidayManagerDK.getHolidays(Year.of(2024)); - assertThat(holidays2024) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .doesNotContain("christian.GENERAL_PRAYER_DAY"); + void ensuresHolidays() { + assertFor(DENMARK) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and() + .hasFixedHoliday("CHRISTMAS", DECEMBER, 25).and() + .hasFixedHoliday("STEPHENS", DECEMBER, 26).and() + .hasChristianHoliday("EASTER").and() + .hasChristianHoliday("MAUNDY_THURSDAY").and() + .hasChristianHoliday("GOOD_FRIDAY").and() + .hasChristianHoliday("EASTER_MONDAY").and() + .hasChristianHoliday("GENERAL_PRAYER_DAY") + .between(Year.of(1990), Year.of(2023)) + .notBetween(Year.of(2024), Year.of(2500)) + .and() + .hasChristianHoliday("ASCENSION_DAY").and() + .hasChristianHoliday("WHIT_MONDAY").and() + .hasChristianHoliday("PENTECOST") + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayEGTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayEGTest.java index 98e6a081e..c806bdb02 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayEGTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayEGTest.java @@ -1,55 +1,78 @@ package de.focus_shift.jollyday.tests.country; -import de.focus_shift.jollyday.core.Holiday; -import de.focus_shift.jollyday.core.HolidayManager; -import de.focus_shift.jollyday.core.ManagerParameters; import org.junit.jupiter.api.Test; -import java.time.LocalDate; import java.time.Year; -import java.util.Set; import static de.focus_shift.jollyday.core.HolidayCalendar.EGYPT; -import static org.assertj.core.api.Assertions.assertThat; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; +import static java.time.Month.APRIL; +import static java.time.Month.JANUARY; +import static java.time.Month.JULY; +import static java.time.Month.JUNE; +import static java.time.Month.MAY; +import static java.time.Month.OCTOBER; -class HolidayEGTest extends AbstractCountryTestBase { +class HolidayEGTest { - private static final Year YEAR = Year.of(2019); + private static final Year YEAR_FROM = Year.of(1900); + private static final Year YEAR_TO = Year.of(2173); @Test - void testNumberOfHolidays() { - final HolidayManager holidayManager = HolidayManager.getInstance(ManagerParameters.create(EGYPT)); - final Set holidays = holidayManager.getHolidays(YEAR); - assertThat(holidays).hasSize(17); - } - - @Test - void testEasterMonday2019() { - final LocalDate expected = LocalDate.of(YEAR.getValue(), 4, 29); - final HolidayManager holidayManager = HolidayManager.getInstance(ManagerParameters.create(EGYPT)); - final Set holidays = holidayManager.getHolidays(YEAR); - assertThat(holidays).hasSize(17); - assertThat(holidays.stream().filter(holiday -> holiday.getPropertiesKey().equals("christian.EASTER_MONDAY") - && holiday.getDate().equals(expected)).count()).isEqualTo(1); - } - - @Test - void testEidFitr2019() { - final LocalDate expected = LocalDate.of(YEAR.getValue(), 6, 4); - final HolidayManager holidayManager = HolidayManager.getInstance(ManagerParameters.create(EGYPT)); - final Set holidays = holidayManager.getHolidays(YEAR); - assertThat(holidays).hasSize(17); - assertThat(holidays.stream().filter(holiday -> holiday.getPropertiesKey().equals("islamic.ID_AL_FITR") - && holiday.getDate().equals(expected)).count()).isEqualTo(1); - } - - @Test - void testArafaat2019() { - final LocalDate expected = LocalDate.of(YEAR.getValue(), 8, 10); - final HolidayManager holidayManager = HolidayManager.getInstance(ManagerParameters.create(EGYPT)); - final Set holidays = holidayManager.getHolidays(YEAR); - assertThat(holidays).hasSize(17); - assertThat(holidays.stream().filter(holiday -> holiday.getPropertiesKey().equals("islamic.ARAFAAT") - && holiday.getDate().equals(expected)).count()).isEqualTo(1); + void ensuresHolidays() { + assertFor(EGYPT) + .hasFixedHoliday("EGYPT_COPTIC_CHRISTMAS", JANUARY, 7) + .between(YEAR_FROM, YEAR_TO) + .and() + .hasFixedHoliday("EGYPT_25_JAN_REVOLUTION", JANUARY, 25) + .between(Year.of(2012), YEAR_TO) + .notBetween(Year.of(1900), Year.of(2011)) + .and() + .hasFixedHoliday("EGYPT_SINAI_LIBERATION", APRIL, 25) + .between(YEAR_FROM, YEAR_TO) + .and() + .hasFixedHoliday("LABOUR_DAY", MAY, 1) + .between(YEAR_FROM, YEAR_TO) + .and() + .hasFixedHoliday("EGYPT_30_JUNE_REVOLUTION", JUNE, 30) + .between(Year.of(2015), YEAR_TO) + .notBetween(Year.of(1900), Year.of(2014)) + .and() + .hasFixedHoliday("EGYPT_23_JULY_REVOLUTION", JULY, 23) + .between(YEAR_FROM, YEAR_TO) + .and() + .hasFixedHoliday("EGYPT_ARMED_FORCES_DAY", OCTOBER, 6) + .between(YEAR_FROM, YEAR_TO) + .and() + .hasChristianHoliday("EASTER_MONDAY") + .between(YEAR_FROM, YEAR_TO) + .and() + .hasIslamicHoliday("ID_AL_FITR") + .between(YEAR_FROM, YEAR_TO) + .and() + .hasIslamicHoliday("ID_AL_FITR_2") + .between(YEAR_FROM, YEAR_TO) + .and() + .hasIslamicHoliday("ID_AL_FITR_3") + .between(YEAR_FROM, YEAR_TO) + .and() + .hasIslamicHoliday("ARAFAAT") + .between(YEAR_FROM, YEAR_TO) + .and() + .hasIslamicHoliday("ID_UL_ADHA") + .between(YEAR_FROM, YEAR_TO) + .and() + .hasIslamicHoliday("ID_UL_ADHA_2") + .between(YEAR_FROM, YEAR_TO) + .and() + .hasIslamicHoliday("ID_UL_ADHA_3") + .between(YEAR_FROM, YEAR_TO) + .and() + .hasIslamicHoliday("NEWYEAR") + .between(YEAR_FROM, YEAR_TO) + .and() + .hasIslamicHoliday("MAWLID_AN_NABI") + .between(YEAR_FROM, YEAR_TO) + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayFITest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayFITest.java index a17d14fc9..fba4b4107 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayFITest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayFITest.java @@ -1,138 +1,35 @@ package de.focus_shift.jollyday.tests.country; -import de.focus_shift.jollyday.core.Holiday; -import de.focus_shift.jollyday.core.HolidayManager; -import net.jqwik.api.ForAll; -import net.jqwik.api.Property; -import net.jqwik.time.api.constraints.YearRange; import org.junit.jupiter.api.Test; -import java.time.LocalDate; -import java.time.Year; -import java.util.Set; - import static de.focus_shift.jollyday.core.HolidayCalendar.FINLAND; -import static de.focus_shift.jollyday.core.HolidayType.PUBLIC_HOLIDAY; -import static de.focus_shift.jollyday.core.ManagerParameters.create; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; import static java.time.Month.DECEMBER; import static java.time.Month.JANUARY; import static java.time.Month.JUNE; import static java.time.Month.MAY; -import static org.assertj.core.api.Assertions.assertThat; - -class HolidayFITest extends AbstractCountryTestBase { - private static final String ISO_CODE = "fi"; - private static final Year YEAR = Year.of(2010); +class HolidayFITest { @Test - void testManagerFIStructure() { - validateCalendarData(ISO_CODE, YEAR); - } - - @Property - void ensuresThatNewYearIsOnFirstJanuary(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(FINLAND)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 1), "NEW_YEAR", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatEpiphanyConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(FINLAND)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 6), "EPIPHANY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatLabourDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(FINLAND)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), MAY, 1), "LABOUR_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatDayOfIndependenceIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(FINLAND)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 6), "INDEPENDENCE_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatOrthodoxChristmasIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(FINLAND)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 24), "CHRISTMAS_EVE", PUBLIC_HOLIDAY)) - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 25), "CHRISTMAS", PUBLIC_HOLIDAY)) - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 26), "STEPHENS", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatEasterIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(FINLAND)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.EASTER"); - } - - @Property - void ensuresThatEasterMondayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(FINLAND)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.EASTER_MONDAY"); - } - - @Property - void ensuresThatGoodFridayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(FINLAND)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.GOOD_FRIDAY"); - } - - @Property - void ensuresThatAscensionDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(FINLAND)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.ASCENSION_DAY"); - } - - @Property - void ensuresThatSelfGovernanceIsConfiguredInAland(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(FINLAND)); - final Set holidays = holidayManager.getHolidays(year, "01"); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JUNE, 9), "SELF_GOVERNANCE", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatWhitSundayIsConfiguredInAland(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(FINLAND)); - final Set holidays = holidayManager.getHolidays(year, "01"); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.WHIT_SUNDAY"); + void ensuresHolidays() { + assertFor(FINLAND) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and() + .hasFixedHoliday("EPIPHANY", JANUARY, 6).and() + .hasFixedHoliday("LABOUR_DAY", MAY, 1).and() + .hasFixedHoliday("INDEPENDENCE_DAY", DECEMBER, 6).and() + .hasFixedHoliday("CHRISTMAS_EVE", DECEMBER, 24).and() + .hasFixedHoliday("CHRISTMAS", DECEMBER, 25).and() + .hasFixedHoliday("STEPHENS", DECEMBER, 26).and() + .hasChristianHoliday("EASTER").and() + .hasChristianHoliday("GOOD_FRIDAY").and() + .hasChristianHoliday("EASTER_MONDAY").and() + .hasChristianHoliday("ASCENSION_DAY").and() + .hasFixedHoliday("SELF_GOVERNANCE", JUNE, 9) + .inSubdivision("01") + .and() + .hasChristianHoliday("WHIT_SUNDAY") + .inSubdivision("01") + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayFRTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayFRTest.java index 42631719d..ae367f5d9 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayFRTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayFRTest.java @@ -4,13 +4,34 @@ import java.time.Year; -class HolidayFRTest extends AbstractCountryTestBase { +import static de.focus_shift.jollyday.core.HolidayCalendar.FRANCE; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; +import static java.time.Month.AUGUST; +import static java.time.Month.DECEMBER; +import static java.time.Month.JANUARY; +import static java.time.Month.JULY; +import static java.time.Month.MAY; +import static java.time.Month.NOVEMBER; - private static final String ISO_CODE = "fr"; - private static final Year YEAR = Year.of(2010); +class HolidayFRTest { @Test - void testManagerFRStructure() { - validateCalendarData(ISO_CODE, YEAR, true); + void ensuresHolidays() { + assertFor(FRANCE) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and() + .hasFixedHoliday("LABOUR_DAY", MAY, 1).and() + .hasFixedHoliday("VICTORY_DAY", MAY, 8).and() + .hasFixedHoliday("NATIONAL_DAY", JULY, 14).and() + .hasFixedHoliday("ASSUMPTION_MARY", AUGUST, 15).and() + .hasFixedHoliday("ALL_SAINTS", NOVEMBER, 1).and() + .hasFixedHoliday("ARMISTICE", NOVEMBER, 11).and() + .hasFixedHoliday("CHRISTMAS", DECEMBER, 25).and() + .hasChristianHoliday("EASTER_MONDAY").and() + .hasChristianHoliday("ASCENSION_DAY").and() + .hasChristianHoliday("WHIT_MONDAY") + .between(Year.of(1900), Year.of(2003)) + .notBetween(Year.of(2004), Year.of(2007)) + .between(Year.of(2008), Year.of(2500)) + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayGETest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayGETest.java index d1b1ab1e5..d119ec8c2 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayGETest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayGETest.java @@ -1,18 +1,9 @@ package de.focus_shift.jollyday.tests.country; -import de.focus_shift.jollyday.core.Holiday; -import de.focus_shift.jollyday.core.HolidayManager; -import net.jqwik.api.ForAll; -import net.jqwik.api.Property; -import net.jqwik.time.api.constraints.YearRange; - -import java.time.LocalDate; -import java.time.Year; -import java.util.Set; +import org.junit.jupiter.api.Test; import static de.focus_shift.jollyday.core.HolidayCalendar.GEORGIA; -import static de.focus_shift.jollyday.core.HolidayType.PUBLIC_HOLIDAY; -import static de.focus_shift.jollyday.core.ManagerParameters.create; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; import static java.time.Month.APRIL; import static java.time.Month.AUGUST; import static java.time.Month.JANUARY; @@ -20,126 +11,29 @@ import static java.time.Month.MAY; import static java.time.Month.NOVEMBER; import static java.time.Month.OCTOBER; -import static org.assertj.core.api.Assertions.assertThat; - -class HolidayGETest extends AbstractCountryTestBase { - - @Property - void ensuresThatNewYearIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(GEORGIA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 1), "NEW_YEAR", PUBLIC_HOLIDAY)) - .contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 2), "NEW_YEAR", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatOrthodoxChristmasIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(GEORGIA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 7), "CHRISTMAS", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatEpiphanyIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(GEORGIA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 19), "EPIPHANY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatMothersDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(GEORGIA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), MARCH, 3), "MOTHERS_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatInternationalWomanDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(GEORGIA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), MARCH, 8), "INTERNATIONAL_WOMAN", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatNationalUnityDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(GEORGIA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), APRIL, 9), "NATIONAL_UNITY_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatEnthronementIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(GEORGIA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), MAY, 9), "DAY_OF_VICTORY_OVER_FASCISM", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatStAndrewFirstCalledDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(GEORGIA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), MAY, 12), "ST_ANDREW_FIRST_CALLED_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatIndependenceDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(GEORGIA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), MAY, 26), "INDEPENDENCE_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatStmaryIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(GEORGIA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), AUGUST, 28), "ST_MARY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatDayOfSvetitskhoveliCathedraIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(GEORGIA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), OCTOBER, 14), "DAY_OF_SVETITSKHOVELI_CATHEDRA", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatStGeorgIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(GEORGIA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), NOVEMBER, 23), "ST_GEORGE", PUBLIC_HOLIDAY)); - } - @Property - void ensuresThatChristianHolidaysAreConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(GEORGIA)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.GOOD_FRIDAY", "christian.EASTER_SATURDAY", "christian.EASTER", "christian.EASTER_MONDAY"); +class HolidayGETest { + + @Test + void ensuresHolidays() { + assertFor(GEORGIA) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and() + .hasFixedHoliday("NEW_YEAR", JANUARY, 2).and() + .hasFixedHoliday("CHRISTMAS", JANUARY, 7).and() + .hasFixedHoliday("EPIPHANY", JANUARY, 19).and() + .hasFixedHoliday("MOTHERS_DAY", MARCH, 3).and() + .hasFixedHoliday("INTERNATIONAL_WOMAN", MARCH, 8).and() + .hasFixedHoliday("NATIONAL_UNITY_DAY", APRIL, 9).and() + .hasFixedHoliday("DAY_OF_VICTORY_OVER_FASCISM", MAY, 9).and() + .hasFixedHoliday("ST_ANDREW_FIRST_CALLED_DAY", MAY, 12).and() + .hasFixedHoliday("INDEPENDENCE_DAY", MAY, 26).and() + .hasFixedHoliday("ST_MARY", AUGUST, 28).and() + .hasFixedHoliday("DAY_OF_SVETITSKHOVELI_CATHEDRA", OCTOBER, 14).and() + .hasFixedHoliday("ST_GEORGE", NOVEMBER, 23).and() + .hasChristianHoliday("GOOD_FRIDAY").and() + .hasChristianHoliday("EASTER_SATURDAY").and() + .hasChristianHoliday("EASTER").and() + .hasChristianHoliday("EASTER_MONDAY") + .check(); } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayNLTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayNLTest.java index 3ed8b9cf5..224d98611 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayNLTest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayNLTest.java @@ -5,6 +5,7 @@ import net.jqwik.api.ForAll; import net.jqwik.api.Property; import net.jqwik.time.api.constraints.YearRange; +import org.junit.jupiter.api.Test; import java.time.LocalDate; import java.time.Year; @@ -13,38 +14,56 @@ import static de.focus_shift.jollyday.core.HolidayCalendar.NETHERLANDS; import static de.focus_shift.jollyday.core.HolidayType.PUBLIC_HOLIDAY; import static de.focus_shift.jollyday.core.ManagerParameters.create; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; +import static de.focus_shift.jollyday.tests.CalendarChecker.Adjuster.PREVIOUS; +import static java.time.DayOfWeek.MONDAY; +import static java.time.DayOfWeek.SATURDAY; +import static java.time.DayOfWeek.SUNDAY; +import static java.time.Month.APRIL; +import static java.time.Month.AUGUST; import static java.time.Month.DECEMBER; import static java.time.Month.JANUARY; import static java.time.Month.MAY; import static org.assertj.core.api.Assertions.assertThat; -class HolidayNLTest extends AbstractCountryTestBase { - - @Property - void ensuresThatNewYearOnFirstIsConfiguredSince1967(@ForAll @YearRange(min = 1967) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(NETHERLANDS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 1), "NEW_YEAR", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatNewYearOnSecondIsNotConfiguredUntil1966(@ForAll @YearRange(max = 1966) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(NETHERLANDS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .doesNotContain(new Holiday(LocalDate.of(year.getValue(), JANUARY, 1), "NEW_YEAR", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatAllLiberationIsNotConfiguredUntil1944(@ForAll @YearRange(max = 1944) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(NETHERLANDS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .doesNotContain(new Holiday(LocalDate.of(year.getValue(), MAY, 5), "LIBERATION", PUBLIC_HOLIDAY)); +class HolidayNLTest { + + @Test + void ensuresHolidays() { + assertFor(NETHERLANDS) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1) + .notBetween(Year.of(1900), Year.of(1966)) + .between(Year.of(1967), Year.of(2500)) + .and() + .hasFixedHoliday("KINGS_DAY", APRIL, 27) + .notBetween(Year.of(1900), Year.of(2013)) + .between(Year.of(2014), Year.of(2500)) + .canBeenShiftedFrom(SUNDAY, PREVIOUS, SATURDAY) + .and() + .hasFixedHoliday("QUEENS_BIRTHDAY", AUGUST, 31) + .between(Year.of(1885), Year.of(1947)) + .notBetween(Year.of(1948), Year.of(2500)) + .and() + .hasFixedHoliday("QUEENS_BIRTHDAY", APRIL, 30) + .between(Year.of(1948), Year.of(1979)) + .canBeenShiftedFrom(SUNDAY, MONDAY) + .and() + .hasFixedHoliday("QUEENS_BIRTHDAY", APRIL, 30) + .between(Year.of(1980), Year.of(2013)) + .canBeenShiftedFrom(SUNDAY, PREVIOUS, SATURDAY) + .and() + .hasFixedHoliday("LIBERATION", MAY, 5) + .between(Year.of(1990), Year.of(2500)) + .and() + .hasFixedHoliday("FIRST_CHRISTMAS_DAY", DECEMBER, 25).and() + .hasFixedHoliday("SECOND_CHRISTMAS_DAY", DECEMBER, 26).and() + .hasChristianHoliday("GOOD_FRIDAY").and() + .hasChristianHoliday("EASTER").and() + .hasChristianHoliday("EASTER_MONDAY").and() + .hasChristianHoliday("ASCENSION_DAY").and() + .hasChristianHoliday("PENTECOST").and() + .hasChristianHoliday("PENTECOST_MONDAY") + .check(); } @Property @@ -57,112 +76,4 @@ void ensuresThatAllLiberationIsConfiguredEveryFiveYearsSince1945Until1989(@ForAl .contains(new Holiday(LocalDate.of(year.getValue(), MAY, 5), "LIBERATION", PUBLIC_HOLIDAY)); } } - - @Property - void ensuresThatAllLiberationIsNotConfiguredBetweenEveryFiveYearsSince1945Until1989(@ForAll @YearRange(min = 1945, max = 1989) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(NETHERLANDS)); - final Set holidays = holidayManager.getHolidays(year); - if (year.getValue() % 5 != 0) { - assertThat(holidays) - .isNotEmpty() - .doesNotContain(new Holiday(LocalDate.of(year.getValue(), MAY, 5), "LIBERATION", PUBLIC_HOLIDAY)); - } - } - - @Property - void ensuresThatAllLiberationIsConfiguredUntil1990(@ForAll @YearRange(min = 1990) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(NETHERLANDS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), MAY, 5), "LIBERATION", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatFirstChristmasDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(NETHERLANDS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 25), "FIRST_CHRISTMAS_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatSecondChristmasDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(NETHERLANDS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 26), "SECOND_CHRISTMAS_DAY", PUBLIC_HOLIDAY)); - } - - @Property - void ensuresThatGoodFridayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(NETHERLANDS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.GOOD_FRIDAY"); - } - - @Property - void ensuresThatEasterIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(NETHERLANDS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.EASTER"); - } - - @Property - void ensuresThatEasterMondayIsConfiguredSince1642(@ForAll @YearRange(min = 1642) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(NETHERLANDS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.EASTER_MONDAY"); - } - - @Property - void ensuresThatEasterMondayIsNotConfiguredUntil1641(@ForAll @YearRange(min = 0, max = 1641) Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(NETHERLANDS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .doesNotContain("christian.EASTER_MONDAY"); - } - - @Property - void ensuresThatAscensionDayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(NETHERLANDS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.ASCENSION_DAY"); - } - - @Property - void ensuresThatPentecostIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(NETHERLANDS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.PENTECOST"); - } - - @Property - void ensuresThatPentecostMondayIsConfigured(@ForAll @YearRange Year year) { - final HolidayManager holidayManager = HolidayManager.getInstance(create(NETHERLANDS)); - final Set holidays = holidayManager.getHolidays(year); - assertThat(holidays) - .isNotEmpty() - .extracting(Holiday::getPropertiesKey) - .contains("christian.PENTECOST_MONDAY"); - } } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidaySETest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidaySETest.java index 1bf72ba1f..8a987d547 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidaySETest.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidaySETest.java @@ -2,15 +2,31 @@ import org.junit.jupiter.api.Test; -import java.time.Year; +import static de.focus_shift.jollyday.core.HolidayCalendar.SWEDEN; +import static de.focus_shift.jollyday.tests.CalendarCheckerApi.assertFor; +import static java.time.Month.DECEMBER; +import static java.time.Month.JANUARY; +import static java.time.Month.JUNE; +import static java.time.Month.MAY; -class HolidaySETest extends AbstractCountryTestBase { - - private static final String ISO_CODE = "se"; - private static final Year YEAR = Year.of(2016); +class HolidaySETest { @Test - void testManagerSEStructure() { - validateCalendarData(ISO_CODE, YEAR, true); + void ensuresHolidays() { + assertFor(SWEDEN) + .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and() + .hasFixedHoliday("EPIPHANY", JANUARY, 6).and() + .hasFixedHoliday("LABOUR_DAY", MAY, 1).and() + .hasFixedHoliday("NATIONAL_DAY", JUNE, 6).and() + .hasFixedHoliday("CHRISTMAS_EVE", DECEMBER, 24).and() + .hasFixedHoliday("CHRISTMAS", DECEMBER, 25).and() + .hasFixedHoliday("BOXING_DAY", DECEMBER, 26).and() + .hasFixedHoliday("NEW_YEARS_EVE", DECEMBER, 31).and() + .hasChristianHoliday("EASTER").and() + .hasChristianHoliday("GOOD_FRIDAY").and() + .hasChristianHoliday("EASTER_MONDAY").and() + .hasChristianHoliday("ASCENSION_DAY").and() + .hasChristianHoliday("PENTECOST") + .check(); } } diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_al_2010.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_al_2010.xml deleted file mode 100644 index a84151068..000000000 --- a/jollyday-tests/src/test/resources/holidays/Holidays_test_al_2010.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_bg_2010.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_bg_2010.xml deleted file mode 100644 index 886ef15a2..000000000 --- a/jollyday-tests/src/test/resources/holidays/Holidays_test_bg_2010.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_de_2010.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_de_2010.xml deleted file mode 100644 index 1491fd0b7..000000000 --- a/jollyday-tests/src/test/resources/holidays/Holidays_test_de_2010.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_de_2022.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_de_2022.xml deleted file mode 100644 index 3905e352b..000000000 --- a/jollyday-tests/src/test/resources/holidays/Holidays_test_de_2022.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_de_2023.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_de_2023.xml deleted file mode 100644 index 147fbed9e..000000000 --- a/jollyday-tests/src/test/resources/holidays/Holidays_test_de_2023.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_fi_2010.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_fi_2010.xml deleted file mode 100644 index 6872ba5f4..000000000 --- a/jollyday-tests/src/test/resources/holidays/Holidays_test_fi_2010.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_fr_2010.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_fr_2010.xml deleted file mode 100644 index 69d74d61b..000000000 --- a/jollyday-tests/src/test/resources/holidays/Holidays_test_fr_2010.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_se_2016.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_se_2016.xml deleted file mode 100644 index d1366c5fa..000000000 --- a/jollyday-tests/src/test/resources/holidays/Holidays_test_se_2016.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -