-
-
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 #191 from focus-shift/187-denmark
denmark: general prayer day only until 2023
- Loading branch information
Showing
5 changed files
with
71 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,7 @@ target/ | |
# Ignore eclipse files | ||
.classpath | ||
.settings/ | ||
.project | ||
.project | ||
|
||
# jqwik | ||
/jollyday-tests/.jqwik-database |
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
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
59 changes: 59 additions & 0 deletions
59
jollyday-tests/src/test/java/de/focus_shift/tests/HolidayDKTest.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,59 @@ | ||
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 org.junit.jupiter.api.Test; | ||
|
||
import java.time.LocalDate; | ||
import java.time.Year; | ||
import java.util.Set; | ||
|
||
import static de.focus_shift.HolidayCalendar.DENMARK; | ||
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.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<Holiday> holidays = holidayManager.getHolidays(year.getValue()); | ||
assertThat(holidays) | ||
.isNotEmpty() | ||
.contains(new Holiday(LocalDate.of(year.getValue(), JANUARY, 1), "NEW_YEAR", OFFICIAL_HOLIDAY)); | ||
} | ||
|
||
@Property | ||
void ensuresThatFirstAndSecondChristmasIsCorrect(@ForAll @YearRange Year year) { | ||
final HolidayManager holidayManager = HolidayManager.getInstance(create(DENMARK)); | ||
final Set<Holiday> holidays = holidayManager.getHolidays(year.getValue()); | ||
assertThat(holidays) | ||
.isNotEmpty() | ||
.contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 25), "CHRISTMAS", OFFICIAL_HOLIDAY)) | ||
.contains(new Holiday(LocalDate.of(year.getValue(), DECEMBER, 26), "STEPHENS", OFFICIAL_HOLIDAY)); | ||
} | ||
|
||
@Test | ||
void ensuresThatGeneralPrayersDayIsOnlyUntil2023() { | ||
final HolidayManager holidayManagerDK = HolidayManager.getInstance(create(DENMARK)); | ||
|
||
final Set<Holiday> holidays2023 = holidayManagerDK.getHolidays(2023); | ||
assertThat(holidays2023) | ||
.isNotEmpty() | ||
.contains(new Holiday(LocalDate.of(2023, MAY, 5), "christian.GENERAL_PRAYER_DAY", OFFICIAL_HOLIDAY)); | ||
|
||
final Set<Holiday> holidays2024 = holidayManagerDK.getHolidays(2024); | ||
assertThat(holidays2024) | ||
.isNotEmpty() | ||
.extracting(Holiday::getPropertiesKey) | ||
.doesNotContain("christian.GENERAL_PRAYER_DAY"); | ||
} | ||
} |
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 @@ | ||
jqwik.reporting.onlyfailures = true |