diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/HolidayCalendar.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/HolidayCalendar.java index 810201224..64554920d 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/HolidayCalendar.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/HolidayCalendar.java @@ -26,7 +26,7 @@ public enum HolidayCalendar { NETHERLANDS("NL"), NEW_ZEALAND("NZ"), NICARAGUA("NI"), NIGERIA("NG"), NORWAY("NO"), NYSE("NYSE"), PANAMA("PA"), PARAGUAY("PY"), PERU("PE"), POLAND("PL"), PORTUGAL("PT"), ROMANIA("RO"), RUSSIA("RU"), - SAUDI_ARABIA("SA"), SERBIA("RS"), SLOWAKIA("SK"), SLOWENIA("SI"), SOUTH_AFRICA("ZA"), SPAIN("ES"), SWEDEN("SE"), SWITZERLAND("CH"), + SAUDI_ARABIA("SA"), SERBIA("RS"), SINGAPORE("SG"), SLOWAKIA("SK"), SLOWENIA("SI"), SOUTH_AFRICA("ZA"), SPAIN("ES"), SWEDEN("SE"), SWITZERLAND("CH"), TARGET("TARGET"), TURKEY("TR"), UKRAINE("UA"), UNITED_ARAB_EMIRATES("AE"), UNITED_KINGDOM(Locale.UK.getCountry()), UNITED_STATES(Locale.US.getCountry()), URUGUAY("UY"), VENEZUELA("VE"); diff --git a/jollyday-core/src/main/resources/descriptions/holiday_descriptions.properties b/jollyday-core/src/main/resources/descriptions/holiday_descriptions.properties index aa1738865..fceb4dcfe 100644 --- a/jollyday-core/src/main/resources/descriptions/holiday_descriptions.properties +++ b/jollyday-core/src/main/resources/descriptions/holiday_descriptions.properties @@ -48,6 +48,7 @@ holiday.description.CESAR_CHAVEZ = César Chávez's Birthday holiday.description.CHACO_ARMISTICE = Chaco Armistice holiday.description.CHATHAM_ISLANDS_ANNIVERSARY = Chatham Islands Anniversary holiday.description.CHILDRENS_DAY = Children's Day +holiday.description.CHINESE_NEW_YEAR = Chinese New Year holiday.description.CHINESE_SPRING_FESTIVAL = Chinese Spring Festival holiday.description.CHRISTMAS = Christmas holiday.description.CHRISTMAS_EVE = Christmas Eve @@ -76,6 +77,7 @@ holiday.description.DAY_OF_PEACE = Day of peace holiday.description.DAY_OF_THE_GORANS = Day of the Gorans holiday.description.DAY_OF_THE_TURKS = Day of the Turks holiday.description.DECLARATION_OF_INDEPENDENCE_DAY = Declaration of Independence day +holiday.description.DEEPAVALI = Deepavali holiday.description.DEFENDER_FATHERLAND = Defender of the Fatherland holiday.description.DEFENDER_OF_UKRAINE = Defender of Ukraine Day holiday.description.DISCOVERY_DAY = Discovery Day @@ -126,6 +128,8 @@ holiday.description.GOODWILL = Day of Goodwill holiday.description.GOVERNMENT_CHANGE = Change of Federal Government holiday.description.GREENERY_DAY = Greenery Day holiday.description.GUANACASTE = Guanacaste Day +holiday.description.HARI_RAYA_HAJI = Hari Raya Haji +holiday.description.HARI_RAYA_PUASA = Hari Raya Puasa holiday.description.HAWKES_BAY_ANNIVERSARY = Hawke's Bay Anniversary holiday.description.HEALTH_SPORTS = Health and Sports Day holiday.description.HERITAGE = Heritage day @@ -213,6 +217,7 @@ holiday.description.PICHINCHA = Battle of Pichincha holiday.description.PICNIC = Picnic Day holiday.description.PIONEER = Pioneer Day holiday.description.PLEBISCITE = Day of the plebiscite +holiday.description.POLLING_DAY = Polling Day holiday.description.PRESEREN = Prešeren Day holiday.description.PRESIDENTS_DAY = Presidents Day holiday.description.PROCLAMATION = Proclamation Day @@ -252,6 +257,7 @@ holiday.description.SERVICE_REDUCTION = Service Reduction Day holiday.description.SETTE_GIUGNO = Sette Giugno holiday.description.SETTLER = Settlers' Day holiday.description.SEWARD = Seward's Day +holiday.description.SG50_PUBLIC_HOLIDAY = SG50 Public Holiday holiday.description.SHOWA_DAY = Showa Day holiday.description.SOLIDARITY_DAY = Solidarity Day holiday.description.SOMERS_DAY = Somers Day @@ -298,6 +304,7 @@ holiday.description.TYNWALD = Tynwald Day holiday.description.UGAADI = Ugaadi holiday.description.UNIFICATION = Unification Day holiday.description.UNIFICATION_GERMANY = German Unity Day +holiday.description.VESAK_DAY = Vesak Day holiday.description.VETERANS_DAY = Veterans Day holiday.description.VICTORIA_DAY = Queen Victorias Birthday holiday.description.VICTORY = Victory Day diff --git a/jollyday-core/src/main/resources/holidays/Holidays_sg.xml b/jollyday-core/src/main/resources/holidays/Holidays_sg.xml new file mode 100644 index 000000000..77d2c60ed --- /dev/null +++ b/jollyday-core/src/main/resources/holidays/Holidays_sg.xml @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidaySGTest.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidaySGTest.java new file mode 100644 index 000000000..11b6de4cd --- /dev/null +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/country/HolidaySGTest.java @@ -0,0 +1,55 @@ +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 de.focus_shift.jollyday.core.util.CalendarUtil; +import de.focus_shift.jollyday.tests.country.base.AbstractCountryTestBase; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import java.time.LocalDate; +import java.util.List; +import java.util.Set; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.fail; + +public class HolidaySGTest extends AbstractCountryTestBase { + + private static final String ISO_CODE = "sg"; + + private final CalendarUtil calendarUtil = new CalendarUtil(); + + @ParameterizedTest + @ValueSource(ints = {2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024}) + void testManagerSGStructure(final int year) { + validateCalendarData(ISO_CODE, year, true); + } + + @Test + void testManagerSGInterval() { + try { + final HolidayManager instance = HolidayManager.getInstance(ManagerParameters.create(HolidayCalendar.SINGAPORE, null)); + final LocalDate startDateInclusive = calendarUtil.create(2022, 10, 1); + final LocalDate endDateInclusive = calendarUtil.create(2023, 1, 31); + final Set holidays = instance.getHolidays(startDateInclusive, endDateInclusive); + final List expected = List.of(calendarUtil.create(2022, 10, 24), + calendarUtil.create(2022, 12, 26), calendarUtil.create(2023, 1, 2), + calendarUtil.create(2023, 1, 24), calendarUtil.create(2023, 1, 23)); + assertThat(holidays).hasSameSizeAs(expected); + for (LocalDate d : expected) { + assertThat(calendarUtil.contains(holidays, d)).isTrue(); + } + } catch (Exception e) { + fail("Unexpected error occurred: " + e.getClass().getName() + " - " + e.getMessage()); + } + } + + @Test + void testManagerDifferentInstanceSG() { + validateManagerDifferentInstance(HolidayCalendar.SINGAPORE); + } +} diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2013.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2013.xml new file mode 100644 index 000000000..d87ad2ede --- /dev/null +++ b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2013.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2014.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2014.xml new file mode 100644 index 000000000..329437841 --- /dev/null +++ b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2014.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2015.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2015.xml new file mode 100644 index 000000000..47bea6fd2 --- /dev/null +++ b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2015.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2016.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2016.xml new file mode 100644 index 000000000..cc22d07a3 --- /dev/null +++ b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2016.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2017.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2017.xml new file mode 100644 index 000000000..95b46b89f --- /dev/null +++ b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2017.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2018.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2018.xml new file mode 100644 index 000000000..c23ffe542 --- /dev/null +++ b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2018.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2019.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2019.xml new file mode 100644 index 000000000..a48484d49 --- /dev/null +++ b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2019.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2020.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2020.xml new file mode 100644 index 000000000..156837bcb --- /dev/null +++ b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2020.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2021.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2021.xml new file mode 100644 index 000000000..27ab839d5 --- /dev/null +++ b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2021.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2022.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2022.xml new file mode 100644 index 000000000..caae327ce --- /dev/null +++ b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2022.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2023.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2023.xml new file mode 100644 index 000000000..631510961 --- /dev/null +++ b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2023.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + diff --git a/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2024.xml b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2024.xml new file mode 100644 index 000000000..082cddd49 --- /dev/null +++ b/jollyday-tests/src/test/resources/holidays/Holidays_test_sg_2024.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + +