Skip to content

Commit

Permalink
Merge pull request #259 from focus-shift/257-cz-easter
Browse files Browse the repository at this point in the history
czech republic: remove easter as public holiday
  • Loading branch information
derTobsch authored Aug 10, 2023
2 parents 5a00802 + 8edd418 commit b39c93d
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 1 deletion.
1 change: 0 additions & 1 deletion jollyday-core/src/main/resources/holidays/Holidays_cz.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<tns:Fixed month="DECEMBER" day="25" descriptionPropertiesKey="CHRISTMAS"/>
<tns:Fixed month="DECEMBER" day="26" descriptionPropertiesKey="STEPHENS"/>
<tns:ChristianHoliday type="GOOD_FRIDAY" validFrom="2016" descriptionPropertiesKey="christian.GOOD_FRIDAY"/>
<tns:ChristianHoliday type="EASTER" descriptionPropertiesKey="christian.EASTER"/>
<tns:ChristianHoliday type="EASTER_MONDAY" descriptionPropertiesKey="christian.EASTER_MONDAY"/>
</tns:Holidays>
</tns:Configuration>
156 changes: 156 additions & 0 deletions jollyday-tests/src/test/java/de/focus_shift/tests/HolidayCZTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
package de.focus_shift.tests;

import de.focus_shift.Holiday;
import de.focus_shift.HolidayManager;
import de.focus_shift.tests.base.AbstractCountryTestBase;
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 static de.focus_shift.HolidayCalendar.CZECH_REPUBLIC;
import static de.focus_shift.HolidayType.OFFICIAL_HOLIDAY;
import static de.focus_shift.ManagerParameters.create;
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;
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<Holiday> holidays = holidayManager.getHolidays(year.getValue());
assertThat(holidays)
.isNotEmpty()
.contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 1), "NEW_YEAR", OFFICIAL_HOLIDAY));
}

@Property
void ensuresThatLabourDayConfigured(@ForAll @YearRange Year year) {
final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC));
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue());
assertThat(holidays)
.isNotEmpty()
.contains(new Holiday(LocalDate.of(year.getValue(), MAY, 1), "LABOUR_DAY", OFFICIAL_HOLIDAY));
}

@Property
void ensuresThatLiberationConfigured(@ForAll @YearRange Year year) {
final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC));
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue());
assertThat(holidays)
.isNotEmpty()
.contains(new Holiday(LocalDate.of(year.getValue(), MAY, 8), "LIBERATION", OFFICIAL_HOLIDAY));
}

@Property
void ensuresThatCyrusMethodiusConfigured(@ForAll @YearRange Year year) {
final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC));
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue());
assertThat(holidays)
.isNotEmpty()
.contains(new Holiday(LocalDate.of(year.getValue(), JULY, 5), "CYRUS_METHODIUS", OFFICIAL_HOLIDAY));
}

@Property
void ensuresThatHusConfigured(@ForAll @YearRange Year year) {
final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC));
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue());
assertThat(holidays)
.isNotEmpty()
.contains(new Holiday(LocalDate.of(year.getValue(), JULY, 6), "HUS", OFFICIAL_HOLIDAY));
}

@Property
void ensuresThatWencelasConfigured(@ForAll @YearRange Year year) {
final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC));
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue());
assertThat(holidays)
.isNotEmpty()
.contains(new Holiday(LocalDate.of(year.getValue(), SEPTEMBER, 28), "WENCELAS", OFFICIAL_HOLIDAY));
}

@Property
void ensuresThatIndependenceDayConfigured(@ForAll @YearRange Year year) {
final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC));
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue());
assertThat(holidays)
.isNotEmpty()
.contains(new Holiday(LocalDate.of(year.getValue(), OCTOBER, 28), "INDEPENDENCE_DAY", OFFICIAL_HOLIDAY));
}

@Property
void ensuresThatFreedomDemocracyConfigured(@ForAll @YearRange Year year) {
final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC));
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue());
assertThat(holidays)
.isNotEmpty()
.contains(new Holiday(LocalDate.of(year.getValue(), NOVEMBER, 17), "FREEDOM_DEMOCRACY", OFFICIAL_HOLIDAY));
}

@Property
void ensuresThatChristmasEveConfigured(@ForAll @YearRange Year year) {
final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC));
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue());
assertThat(holidays)
.isNotEmpty()
.contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 24), "CHRISTMAS_EVE", OFFICIAL_HOLIDAY));
}

@Property
void ensuresThatChristmasConfigured(@ForAll @YearRange Year year) {
final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC));
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue());
assertThat(holidays)
.isNotEmpty()
.contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 25), "CHRISTMAS", OFFICIAL_HOLIDAY));
}

@Property
void ensuresThatStephensConfigured(@ForAll @YearRange Year year) {
final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC));
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue());
assertThat(holidays)
.isNotEmpty()
.contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 26), "STEPHENS", OFFICIAL_HOLIDAY));
}

@Property
void ensuresThatGoodFridayIsConfiguredSince2016(@ForAll @YearRange(min = 2016) Year year) {
final HolidayManager holidayManager = HolidayManager.getInstance(create(CZECH_REPUBLIC));
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue());
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<Holiday> holidays = holidayManager.getHolidays(year.getValue());
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<Holiday> holidays = holidayManager.getHolidays(year.getValue());
assertThat(holidays)
.isNotEmpty()
.extracting(Holiday::getPropertiesKey)
.contains("christian.EASTER_MONDAY");
}
}

0 comments on commit b39c93d

Please sign in to comment.