diff --git a/jollyday-core/src/main/resources/holidays/Holidays_tr.xml b/jollyday-core/src/main/resources/holidays/Holidays_tr.xml
index d6728e2a8..c480b4e99 100644
--- a/jollyday-core/src/main/resources/holidays/Holidays_tr.xml
+++ b/jollyday-core/src/main/resources/holidays/Holidays_tr.xml
@@ -12,8 +12,7 @@
-
+
diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayTRTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayTRTest.java
index 8972bc371..ed5ff94d0 100644
--- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayTRTest.java
+++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayTRTest.java
@@ -1,65 +1,52 @@
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.ManagerParameters;
import org.junit.jupiter.api.Test;
-import java.time.LocalDate;
import java.time.Year;
-import java.util.Set;
-import static org.assertj.core.api.Assertions.assertThat;
+import static de.focus_shift.jollyday.core.HolidayCalendar.TURKEY;
+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;
+import static java.time.Month.JULY;
+import static java.time.Month.MAY;
+import static java.time.Month.OCTOBER;
-class HolidayTRTest extends AbstractCountryTestBase {
+class HolidayTRTest {
- private static final String ISO_CODE = "tr";
- private static final Year YEAR = Year.of(2019);
-
-
- @Test
- void testManagerTRStructure() {
- validateCalendarData(ISO_CODE, YEAR);
- }
-
- @Test
- void testNumberOfHolidays() {
- final HolidayManager holidayManager = HolidayManager.getInstance(ManagerParameters.create(HolidayCalendar.TURKEY));
- final Set holidays = holidayManager.getHolidays(YEAR);
- assertThat(holidays).hasSize(9);
- }
-
- @Test
- void testRamazan2019() {
- // Actually, in Turkey, Ramadan is one day after Eid Mubarak, for keep the Eid al Fitr for now
- final LocalDate expected = LocalDate.of(YEAR.getValue(), 6, 4);
- final HolidayManager holidayManager = HolidayManager.getInstance(ManagerParameters.create(HolidayCalendar.TURKEY));
- final Set holidays = holidayManager.getHolidays(YEAR);
- assertThat(holidays).hasSize(9);
- boolean found = false;
- for (Holiday holiday : holidays) {
- if (holiday.getPropertiesKey().equals("islamic.ID_AL_FITR") && holiday.getDate().equals(expected)) {
- found = true;
- break;
- }
- }
- assertThat(found).isTrue();
- }
+ private static final Year YEAR_FROM = Year.of(1900);
+ private static final Year YEAR_TO = Year.of(2173);
@Test
- void testKurban2019() {
- final LocalDate expected = LocalDate.of(YEAR.getValue(), 8, 11);
- final HolidayManager holidayManager = HolidayManager.getInstance(ManagerParameters.create(HolidayCalendar.TURKEY));
- final Set holidays = holidayManager.getHolidays(YEAR);
- assertThat(holidays).hasSize(9);
- boolean found = false;
- for (Holiday holiday : holidays) {
- if (holiday.getPropertiesKey().equals("islamic.ID_UL_ADHA") && holiday.getDate().equals(expected)) {
- found = true;
- break;
- }
- }
- assertThat(found).isTrue();
+ void ensuresHolidays() {
+
+ assertFor(TURKEY)
+ .hasFixedHoliday("NEW_YEAR", JANUARY, 1)
+ .between(YEAR_FROM, YEAR_TO)
+ .and()
+ .hasFixedHoliday("TURKEY_CHILDRENS_DAY", APRIL, 23)
+ .between(YEAR_FROM, YEAR_TO)
+ .and()
+ .hasFixedHoliday("LABOUR_DAY", MAY, 1)
+ .between(YEAR_FROM, YEAR_TO)
+ .and()
+ .hasFixedHoliday("TURKEY_COMMEMORATION_OF_ATATURK", MAY, 19)
+ .between(Year.of(2004), YEAR_TO)
+ .and()
+ .hasFixedHoliday("TURKEY_DEMOCRATIC_UNITY_DAY", JULY, 15)
+ .between(YEAR_FROM, YEAR_TO).and()
+ .hasFixedHoliday("TURKEY_VICTORY_DAY", AUGUST, 30)
+ .between(Year.of(2003), YEAR_TO)
+ .and()
+ .hasFixedHoliday("TURKEY_REPUBLIC_DAY", OCTOBER, 29)
+ .between(Year.of(2003), YEAR_TO)
+ .and()
+ .hasIslamicHoliday("ID_AL_FITR")
+ .between(YEAR_FROM, YEAR_TO)
+ .and()
+ .hasIslamicHoliday("ID_UL_ADHA")
+ .between(YEAR_FROM, YEAR_TO)
+ .check();
}
}
diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayUYTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayUYTest.java
index 4093262f4..69d532e63 100644
--- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayUYTest.java
+++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidayUYTest.java
@@ -1,80 +1,58 @@
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.BeforeEach;
import org.junit.jupiter.api.Test;
-import java.time.LocalDate;
-import java.time.Year;
-import java.util.Set;
+import java.time.DayOfWeek;
import static de.focus_shift.jollyday.core.HolidayCalendar.URUGUAY;
-import static org.assertj.core.api.Assertions.assertThat;
-
-class HolidayUYTest extends AbstractCountryTestBase {
-
- private HolidayManager holidayManager;
-
- @BeforeEach
- void init() {
- holidayManager = HolidayManager.getInstance(ManagerParameters.create(URUGUAY));
- }
-
- @Test
- void testManagerUYStructure() {
- validateCalendarData("uy", Year.of(2016));
- }
-
- @Test
- void testManagerUYLanding33EasternersMovingDaysWhenLanding33EasternersOnTuesday() {
- final int year = 2016;
- final LocalDate landing33Easterners = LocalDate.of(year, 4, 18);
- assertThat(contains(landing33Easterners, holidayManager.getHolidays(Year.of(year)))).isTrue();
- }
-
- @Test
- void testManagerUYLanding33EasternersMovingDaysWhenLanding33EasternersOnThursday() {
- final int year = 2007;
- final LocalDate landing33Easterners = LocalDate.of(year, 4, 23);
- assertThat(contains(landing33Easterners, holidayManager.getHolidays(Year.of(year)))).isTrue();
- }
-
- @Test
- void testManagerUYRaceMovingDaysWhenRaceOnWednesday() {
- final int year = 2016;
- final LocalDate race = LocalDate.of(year, 10, 10);
- assertThat(contains(race, holidayManager.getHolidays(Year.of(year)))).isTrue();
- }
-
- @Test
- void testManagerUYRaceMovingDaysWhenRaceOnFriday() {
- final int year = 2007;
- final LocalDate race = LocalDate.of(year, 10, 15);
- assertThat(contains(race, holidayManager.getHolidays(Year.of(year)))).isTrue();
- }
-
- @Test
- void testManagerUYLasPiedrasMovingDaysWhenLasPiedrasOnTuesday() {
- final int year = 2016;
- final LocalDate lasPiedras = LocalDate.of(year, 5, 16);
- assertThat(contains(lasPiedras, holidayManager.getHolidays(Year.of(year)))).isTrue();
- }
+import static de.focus_shift.jollyday.tests.CalendarChecker.Adjuster.PREVIOUS;
+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;
+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.NOVEMBER;
+import static java.time.Month.OCTOBER;
+
+class HolidayUYTest {
@Test
- void testManagerUYLasPiedrasMovingDaysWhenLasPiedrasOnFriday() {
- final int year = 2007;
- final LocalDate lasPiedras = LocalDate.of(year, 5, 21);
- assertThat(contains(lasPiedras, holidayManager.getHolidays(Year.of(year)))).isTrue();
- }
-
- private boolean contains(LocalDate localDate, Set holidays) {
- for (Holiday h : holidays) {
- if (localDate.equals(h.getDate())) {
- return true;
- }
- }
- return false;
+ void ensuresHolidays() {
+ assertFor(URUGUAY)
+ .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and()
+ .hasFixedHoliday("EPIPHANY", JANUARY, 6).and()
+ .hasFixedHoliday("LANDING_33_EASTERNERS", APRIL, 19)
+ .canBeenShiftedFrom(DayOfWeek.TUESDAY, PREVIOUS, DayOfWeek.MONDAY)
+ .canBeenShiftedFrom(DayOfWeek.WEDNESDAY, PREVIOUS, DayOfWeek.MONDAY)
+ .canBeenShiftedFrom(DayOfWeek.THURSDAY, DayOfWeek.MONDAY)
+ .canBeenShiftedFrom(DayOfWeek.FRIDAY, DayOfWeek.MONDAY)
+ .and()
+ .hasFixedHoliday("LABOUR_DAY", MAY, 1).and()
+ .hasFixedHoliday("LAS_PIEDRAS", MAY, 18)
+ .canBeenShiftedFrom(DayOfWeek.TUESDAY, PREVIOUS, DayOfWeek.MONDAY)
+ .canBeenShiftedFrom(DayOfWeek.WEDNESDAY, PREVIOUS, DayOfWeek.MONDAY)
+ .canBeenShiftedFrom(DayOfWeek.THURSDAY, DayOfWeek.MONDAY)
+ .canBeenShiftedFrom(DayOfWeek.FRIDAY, DayOfWeek.MONDAY)
+ .and()
+ .hasFixedHoliday("ARTIGAS", JUNE, 19).and()
+ .hasFixedHoliday("CONSTITUTION_DAY", JULY, 18).and()
+ .hasFixedHoliday("INDEPENDENCE_DAY", AUGUST, 25).and()
+ .hasFixedHoliday("ALL_SOULS", NOVEMBER, 2).and()
+ .hasFixedHoliday("CHRISTMAS", DECEMBER, 25).and()
+ .hasFixedHoliday("RACE", OCTOBER, 12)
+ .canBeenShiftedFrom(DayOfWeek.TUESDAY, PREVIOUS, DayOfWeek.MONDAY)
+ .canBeenShiftedFrom(DayOfWeek.WEDNESDAY, PREVIOUS, DayOfWeek.MONDAY)
+ .canBeenShiftedFrom(DayOfWeek.THURSDAY, DayOfWeek.MONDAY)
+ .canBeenShiftedFrom(DayOfWeek.FRIDAY, DayOfWeek.MONDAY)
+ .and()
+ .hasChristianHoliday("EASTER").and()
+ .hasChristianHoliday("SHROVE_MONDAY").and()
+ .hasChristianHoliday("CARNIVAL").and()
+ .hasChristianHoliday("MAUNDY_THURSDAY").and()
+ .hasChristianHoliday("GOOD_FRIDAY")
+ .check();
}
}
diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_tr_2019.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_tr_2019.xml
deleted file mode 100644
index cd53efb62..000000000
--- a/jollyday-tests/src/test/resources/holidays/Holidays_test_tr_2019.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_uy_2016.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_uy_2016.xml
deleted file mode 100644
index c3e87b4da..000000000
--- a/jollyday-tests/src/test/resources/holidays/Holidays_test_uy_2016.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-