-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #259 from focus-shift/257-cz-easter
czech republic: remove easter as public holiday
- Loading branch information
Showing
2 changed files
with
156 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
156 changes: 156 additions & 0 deletions
156
jollyday-tests/src/test/java/de/focus_shift/tests/HolidayCZTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |