[ephemeris] Add support for overriding holiday definitions (#3573)

* Add support for overriding holiday definitions

End Danish General Prayer Day

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen
2023-05-02 09:11:59 +02:00
committed by GitHub
parent 476975a012
commit c8464870bb
3 changed files with 68 additions and 19 deletions
@@ -47,6 +47,7 @@ import org.openhab.core.test.java.JavaOSGiTest;
public class EphemerisManagerImplOSGiTest extends JavaOSGiTest {
private static final String INTERNAL_DAYSET = "internal";
private static final URI CONFIG_URI = URI.create("system:ephemeris");
private static final String COUNTRY_DENMARK_KEY = "dk";
private static final String COUNTRY_AUSTRALIA_KEY = "au";
private static final String COUNTRY_AUSTRALIA_NAME = "Australia";
private static final String REGION_BAVARIA_KEY = "by";
@@ -263,6 +264,20 @@ public class EphemerisManagerImplOSGiTest extends JavaOSGiTest {
assertFalse(vacation);
}
@Test
public void testIsBankHolidayWhenGeneralPrayerDay2023() {
ZonedDateTime generalPrayerDay = ZonedDateTime.of(2023, 05, 05, 0, 0, 0, 0, ZoneId.of("Europe/Paris"));
ephemerisManager.modified(Map.of(CONFIG_COUNTRY, COUNTRY_DENMARK_KEY));
assertTrue(ephemerisManager.isBankHoliday(generalPrayerDay));
}
@Test
public void testIsBankHolidayWhenGeneralPrayerDay2024() {
ZonedDateTime generalPrayerDay = ZonedDateTime.of(2024, 04, 26, 0, 0, 0, 0, ZoneId.of("Europe/Paris"));
ephemerisManager.modified(Map.of(CONFIG_COUNTRY, COUNTRY_DENMARK_KEY));
assertFalse(ephemerisManager.isBankHoliday(generalPrayerDay));
}
@Test
public void testGetBankHoliday() {
ZonedDateTime theDay = ZonedDateTime.of(2019, 01, 01, 0, 0, 0, 0, ZoneId.of("Europe/Paris"));