Repository: urlaubsverwaltung/urlaubsverwaltung (java)

Issue:
Belgische Feiertage
Als belgischer Mitarbeitende möchte ich die passenden Feiertage in der Urlaubsverwaltung nutzen können.

https://de.beldelux.com/feiertage-in-2022-in-belgien/

Ersatzfeiertage konfigurieren: #3108 

Pull request:
Add belgium public holidays
closes #3107 

Patch:
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/publicholiday/PublicHolidayConfiguration.java b/src/main/java/org/synyx/urlaubsverwaltung/publicholiday/PublicHolidayConfiguration.java
index d71add7cf..2344115cf 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/publicholiday/PublicHolidayConfiguration.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/publicholiday/PublicHolidayConfiguration.java
@@ -13,7 +13,7 @@ import java.util.Map;
 @Configuration
 class PublicHolidayConfiguration {
 
-    private static final List<String> COUNTRIES = List.of("de", "at", "ch", "gb", "gr", "mt", "it", "hr", "es", "nl", "lt");
+    private static final List<String> COUNTRIES = List.of("de", "at", "ch", "gb", "gr", "mt", "it", "hr", "es", "nl", "lt", "be");
 
     @Bean
     Map<String, HolidayManager> holidayManagerMap() {
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/workingtime/FederalState.java b/src/main/java/org/synyx/urlaubsverwaltung/workingtime/FederalState.java
index 3662de235..48077e61a 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/workingtime/FederalState.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/workingtime/FederalState.java
@@ -114,7 +114,9 @@ public enum FederalState {
 
     NETHERLANDS("nl", "nl"),
 
-    LITHUANIA("lt", "lt");
+    LITHUANIA("lt", "lt"),
+
+    BELGIUM("be", "be");
 
     private final String[] codes;
 
diff --git a/src/main/resources/Holidays_be.xml b/src/main/resources/Holidays_be.xml
new file mode 100644
index 000000000..48d9ab2f0
--- /dev/null
+++ b/src/main/resources/Holidays_be.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Configuration hierarchy="be" description="Belgium"
+               xmlns="https://focus_shift.de/jollyday/schema/holiday"
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xsi:schemaLocation="https://focus_shift.de/jollyday/schema/holiday https://focus_shift.de/jollyday/schema/holiday/holiday.xsd">
+  <Holidays>
+    <Fixed month="JANUARY" day="1" descriptionPropertiesKey="NEW_YEAR"/>
+    <Fixed month="MAY" day="1" descriptionPropertiesKey="LABOUR_DAY"/>
+    <Fixed month="JULY" day="21" descriptionPropertiesKey="NATIONAL_DAY"/>
+    <Fixed month="AUGUST" day="15" descriptionPropertiesKey="ASSUMPTION_DAY"/>
+    <Fixed month="NOVEMBER" day="1" descriptionPropertiesKey="ALL_SAINTS"/>
+    <Fixed month="NOVEMBER" day="11" descriptionPropertiesKey="ARMISTICE"/>
+    <Fixed month="DECEMBER" day="24" descriptionPropertiesKey="CHRISTMAS_EVE" localizedType="UNOFFICIAL_HOLIDAY"/>
+    <Fixed month="DECEMBER" day="25" descriptionPropertiesKey="CHRISTMAS"/>
+    <Fixed month="DECEMBER" day="31" descriptionPropertiesKey="NEW_YEARS_EVE" localizedType="UNOFFICIAL_HOLIDAY"/>
+    <ChristianHoliday type="EASTER" descriptionPropertiesKey="christian.EASTER"/>
+    <ChristianHoliday type="EASTER_MONDAY" descriptionPropertiesKey="christian.EASTER_MONDAY"/>
+    <ChristianHoliday type="ASCENSION_DAY" descriptionPropertiesKey="christian.ASCENSION_DAY"/>
+    <ChristianHoliday type="PENTECOST" descriptionPropertiesKey="christian.PENTECOST"/>
+    <ChristianHoliday type="PENTECOST_MONDAY" descriptionPropertiesKey="christian.PENTECOST_MONDAY"/>
+  </Holidays>
+</Configuration>
diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties
index fda09e42f..6d15aa41a 100644
--- a/src/main/resources/messages.properties
+++ b/src/main/resources/messages.properties
@@ -1109,6 +1109,7 @@ country.hr=Kroatien
 country.es=Spanien
 country.nl=Niederlande
 country.lt=Litauen
+country.be=Belgien
 
 # No Federal States
 federalState.NONE=Keine Feiertagesregelung
@@ -1225,6 +1226,9 @@ federalState.NETHERLANDS=Niederlande
 # Federal States Lithuania
 federalState.LITHUANIA=Litauen
 
+# Federal States Belgium
+federalState.BELGIUM=Belgien
+
 # DEPARTMENTS
 departments.header.title=Abteilungsübersicht
 departments.title=Abteilungen
diff --git a/src/main/resources/messages_de_AT.properties b/src/main/resources/messages_de_AT.properties
index 2034cd93f..a2b7998bc 100644
--- a/src/main/resources/messages_de_AT.properties
+++ b/src/main/resources/messages_de_AT.properties
@@ -1061,6 +1061,7 @@ country.hr=Kroatien
 country.es=Spanien
 country.nl=Niederlande
 country.lt=Litauen
+country.be=Belgien
 
 # No Federal States
 federalState.NONE=Keine Feiertagesregelung
@@ -1177,6 +1178,9 @@ federalState.NETHERLANDS=Niederlande
 # Federal States Lithuania
 federalState.LITHUANIA=Litauen
 
+# Federal States Belgium
+federalState.BELGIUM=Belgien
+
 # DEPARTMENTS
 departments.header.title=Abteilungsübersicht
 departments.title=Abteilungen
diff --git a/src/main/resources/messages_el.properties b/src/main/resources/messages_el.properties
index 578a2504d..f23d453cd 100644
--- a/src/main/resources/messages_el.properties
+++ b/src/main/resources/messages_el.properties
@@ -1006,6 +1006,7 @@ country.hr=Κροατία
 country.es=Ισπανία
 country.nl=Ολλανδία
 country.lt=Λιθουανία
+country.be=Βέλγιο
 
 # No Federal States
 federalState.NONE=Κανένας κανονισμός επίσημων αργιών
@@ -1122,6 +1123,9 @@ federalState.NETHERLANDS=Ολλανδία
 # Federal States Lithuania
 federalState.LITHUANIA=Λιθουανία
 
+# Federal States Belgium
+federalState.BELGIUM=Βέλγιο
+
 # DEPARTMENTS
 departments.header.title=Επισκόπηση τμημάτων
 departments.title=Τμήματα
diff --git a/src/main/resources/messages_en.properties b/src/main/resources/messages_en.properties
index b9a4be9dc..659bd0b8f 100644
--- a/src/main/resources/messages_en.properties
+++ b/src/main/resources/messages_en.properties
@@ -1080,7 +1080,7 @@ country.hr=Croatia
 country.es=Spain
 country.nl=The Netherlands
 country.lt=Lithuania
-
+country.be=Belgium
 
 # No Federal States
 federalState.NONE=No public holiday regulation
@@ -1197,6 +1197,9 @@ federalState.NETHERLANDS=The Netherlands
 # Federal States Lithuania
 federalState.LITHUANIA=Lithuania
 
+# Federal States Belgium
+federalState.BELGIUM=Belgium
+
 # DEPARTMENTS
 departments.header.title=Departments overview
 departments.title=Departments


Test patch:
diff --git a/src/test/java/org/synyx/urlaubsverwaltung/workingtime/FederalStateTest.java b/src/test/java/org/synyx/urlaubsverwaltung/workingtime/FederalStateTest.java
index 62ea84e60..eb54c2825 100644
--- a/src/test/java/org/synyx/urlaubsverwaltung/workingtime/FederalStateTest.java
+++ b/src/test/java/org/synyx/urlaubsverwaltung/workingtime/FederalStateTest.java
@@ -10,7 +10,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.stream.Stream;
 
-import static java.util.stream.Collectors.toList;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.entry;
 import static org.synyx.urlaubsverwaltung.workingtime.FederalState.AUSTRIA_BURGENLAND;
@@ -22,6 +21,7 @@ import static org.synyx.urlaubsverwaltung.workingtime.FederalState.AUSTRIA_STEIE
 import static org.synyx.urlaubsverwaltung.workingtime.FederalState.AUSTRIA_TIROL;
 import static org.synyx.urlaubsverwaltung.workingtime.FederalState.AUSTRIA_VORARLBERG;
 import static org.synyx.urlaubsverwaltung.workingtime.FederalState.AUSTRIA_WIEN;
+import static org.synyx.urlaubsverwaltung.workingtime.FederalState.BELGIUM;
 import static org.synyx.urlaubsverwaltung.workingtime.FederalState.CROATIA;
 import static org.synyx.urlaubsverwaltung.workingtime.FederalState.GERMANY_BADEN_WUERTTEMBERG;
 import static org.synyx.urlaubsverwaltung.workingtime.FederalState.GERMANY_BAYERN;
@@ -212,7 +212,9 @@ class FederalStateTest {
 
             Arguments.of(NETHERLANDS, "nl", null),
 
-            Arguments.of(LITHUANIA, "lt", null)
+            Arguments.of(LITHUANIA, "lt", null),
+
+            Arguments.of(BELGIUM, "be", null)
         );
     }
 
@@ -340,22 +342,23 @@ class FederalStateTest {
     @Test
     void ensureCorrectFederalStatesByCountry() {
         final Map<String, List<FederalState>> federalStatesTypesByCountry = FederalState.federalStatesTypesByCountry();
-        final List<FederalState> germanyFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "de".equals(federalState.getCountry())).collect(toList());
-        final List<FederalState> austriaFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "at".equals(federalState.getCountry())).collect(toList());
-        final List<FederalState> switzerlandFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "ch".equals(federalState.getCountry())).collect(toList());
-        final List<FederalState> ukFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "gb".equals(federalState.getCountry())).collect(toList());
-        final List<FederalState> grFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "gr".equals(federalState.getCountry())).collect(toList());
-        final List<FederalState> mtFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "mt".equals(federalState.getCountry())).collect(toList());
-        final List<FederalState> itFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "it".equals(federalState.getCountry())).collect(toList());
-        final List<FederalState> hrFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "hr".equals(federalState.getCountry())).collect(toList());
-        final List<FederalState> esFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "es".equals(federalState.getCountry())).collect(toList());
-        final List<FederalState> nlFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "nl".equals(federalState.getCountry())).collect(toList());
-        final List<FederalState> ltFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "lt".equals(federalState.getCountry())).collect(toList());
+        final List<FederalState> deFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "de".equals(federalState.getCountry())).toList();
+        final List<FederalState> atFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "at".equals(federalState.getCountry())).toList();
+        final List<FederalState> chFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "ch".equals(federalState.getCountry())).toList();
+        final List<FederalState> ukFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "gb".equals(federalState.getCountry())).toList();
+        final List<FederalState> grFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "gr".equals(federalState.getCountry())).toList();
+        final List<FederalState> mtFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "mt".equals(federalState.getCountry())).toList();
+        final List<FederalState> itFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "it".equals(federalState.getCountry())).toList();
+        final List<FederalState> hrFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "hr".equals(federalState.getCountry())).toList();
+        final List<FederalState> esFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "es".equals(federalState.getCountry())).toList();
+        final List<FederalState> nlFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "nl".equals(federalState.getCountry())).toList();
+        final List<FederalState> ltFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "lt".equals(federalState.getCountry())).toList();
+        final List<FederalState> beFederalStates = Arrays.stream(FederalState.values()).filter(federalState -> "be".equals(federalState.getCountry())).toList();
 
-        assertThat(federalStatesTypesByCountry).hasSize(11)
-            .contains(entry("de", germanyFederalStates))
-            .contains(entry("at", austriaFederalStates))
-            .contains(entry("ch", switzerlandFederalStates))
+        assertThat(federalStatesTypesByCountry).hasSize(12)
+            .contains(entry("de", deFederalStates))
+            .contains(entry("at", atFederalStates))
+            .contains(entry("ch", chFederalStates))
             .contains(entry("gb", ukFederalStates))
             .contains(entry("gr", grFederalStates))
             .contains(entry("mt", mtFederalStates))
@@ -363,6 +366,7 @@ class FederalStateTest {
             .contains(entry("hr", hrFederalStates))
             .contains(entry("es", esFederalStates))
             .contains(entry("nl", nlFederalStates))
-            .contains(entry("lt", ltFederalStates));
+            .contains(entry("lt", ltFederalStates))
+            .contains(entry("be", beFederalStates));
     }
 }