Explorar el Código

CensusEntry Gaelic added to domain

Andrew Grant hace 5 meses
padre
commit
70d7442458

+ 10 - 0
src/main/java/scot/carricksoftware/grants/domains/census/CensusEntry.java

@@ -8,6 +8,7 @@ package scot.carricksoftware.grants.domains.census;
 import jakarta.persistence.*;
 import scot.carricksoftware.grants.BaseEntity;
 import scot.carricksoftware.grants.domains.people.Person;
+import scot.carricksoftware.grants.enums.censusentry.CensusEntryGaelic;
 import scot.carricksoftware.grants.enums.censusentry.CensusEntryRelationship;
 import scot.carricksoftware.grants.enums.censusentry.CensusEntryCondition;
 
@@ -29,6 +30,9 @@ public class CensusEntry extends BaseEntity {
     @Enumerated(EnumType.STRING)
     private CensusEntryRelationship relationship;
 
+    @Enumerated(EnumType.STRING)
+    private CensusEntryGaelic Gaelic;
+
     @Enumerated(EnumType.STRING)
     private CensusEntryCondition condition;
 
@@ -76,5 +80,11 @@ public class CensusEntry extends BaseEntity {
         this.condition = condition;
     }
 
+    public CensusEntryGaelic getGaelic() {
+        return Gaelic;
+    }
 
+    public void setGaelic(CensusEntryGaelic gaelic) {
+        Gaelic = gaelic;
+    }
 }

+ 19 - 0
src/main/java/scot/carricksoftware/grants/enums/censusentry/CensusEntryGaelic.java

@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grants.enums.censusentry;
+
+public enum CensusEntryGaelic {
+    @SuppressWarnings("unused") GAELIC("Gaelic"),
+    @SuppressWarnings("unused") GAELICANDENGLISH("Gaelic and English");
+
+    @SuppressWarnings("unused")
+    public final String label;
+
+    @SuppressWarnings("unused")
+    CensusEntryGaelic(String label) {
+        this.label = label;
+    }
+}

+ 1 - 1
src/main/resources/application.properties

@@ -2,7 +2,7 @@ spring.application.name=grants
 server.port=8086
 server.servlet.context-path=/grants
 spring.mvc.format.date=dd-MM-yyyy
-spring.profiles.active=uat
+spring.profiles.active=dev
 logging.level.scot.carricksoftware=debug
 
 

+ 0 - 28
src/test/java/scot/carricksoftware/grants/GenerateCensusEntryConditionRandomValue.java

@@ -1,28 +0,0 @@
-/*
- * Copyright (c)  04 Feb 2025, Andrew Grant of Carrick Software .
- * All rights reserved.
- */
-
-package scot.carricksoftware.grants;
-
-import org.springframework.stereotype.Component;
-import scot.carricksoftware.grants.enums.censusentry.CensusEntryCondition;
-
-import java.util.Random;
-
-@SuppressWarnings("unused")
-@Component
-public class GenerateCensusEntryConditionRandomValue {
-
-    public static CensusEntryCondition GetRandomCensusEntryCondition() {
-
-        CensusEntryCondition[] conditions = CensusEntryCondition.values();
-
-        Random random = new Random();
-        int randomInt = random.nextInt(0, conditions.length );
-        return conditions[randomInt];
-    }
-
-
-
-}

+ 44 - 0
src/test/java/scot/carricksoftware/grants/GenerateCensusEntryRandomEnums.java

@@ -0,0 +1,44 @@
+/*
+ * Copyright (c)  04 Feb 2025, Andrew Grant of Carrick Software .
+ * All rights reserved.
+ */
+
+package scot.carricksoftware.grants;
+
+import org.springframework.stereotype.Component;
+import scot.carricksoftware.grants.enums.censusentry.CensusEntryCondition;
+import scot.carricksoftware.grants.enums.censusentry.CensusEntryGaelic;
+import scot.carricksoftware.grants.enums.censusentry.CensusEntryRelationship;
+
+import java.util.Random;
+
+@SuppressWarnings("unused")
+@Component
+public class GenerateCensusEntryRandomEnums {
+
+    public static CensusEntryCondition GetRandomCensusEntryCondition() {
+
+        CensusEntryCondition[] conditions = CensusEntryCondition.values();
+
+        Random random = new Random();
+        int randomInt = random.nextInt(0, conditions.length );
+        return conditions[randomInt];
+    }
+
+    public static CensusEntryGaelic GetRandomCensusEntryGaelic() {
+        CensusEntryGaelic[] gaelicArray = CensusEntryGaelic.values();
+
+        Random random = new Random();
+        int randomInt = random.nextInt(0, gaelicArray.length );
+        return gaelicArray[randomInt];
+    }
+
+
+    public static CensusEntryRelationship GetRandomCensusEntryRelationship() {
+        CensusEntryRelationship[] relationships = CensusEntryRelationship.values();
+
+        Random random = new Random();
+        int randomInt = random.nextInt(0, relationships.length );
+        return relationships[randomInt];
+    }
+}

+ 0 - 28
src/test/java/scot/carricksoftware/grants/GenerateCensusEntryRelationshipRandomValue.java

@@ -1,28 +0,0 @@
-/*
- * Copyright (c)  04 Feb 2025, Andrew Grant of Carrick Software .
- * All rights reserved.
- */
-
-package scot.carricksoftware.grants;
-
-import org.springframework.stereotype.Component;
-import scot.carricksoftware.grants.enums.censusentry.CensusEntryRelationship;
-
-import java.util.Random;
-
-@SuppressWarnings("unused")
-@Component
-public class GenerateCensusEntryRelationshipRandomValue {
-
-    public static CensusEntryRelationship GetRandomCensusEntryRelationship() {
-
-        CensusEntryRelationship[] relationships = CensusEntryRelationship.values();
-
-        Random random = new Random();
-        int randomInt = random.nextInt(0, relationships.length );
-        return relationships[randomInt];
-    }
-
-
-
-}

+ 2 - 2
src/test/java/scot/carricksoftware/grants/commands/census/CensusEntryCommandEnumTest.java

@@ -13,8 +13,8 @@ import scot.carricksoftware.grants.enums.censusentry.CensusEntryRelationship;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
-import static scot.carricksoftware.grants.GenerateCensusEntryConditionRandomValue.GetRandomCensusEntryCondition;
-import static scot.carricksoftware.grants.GenerateCensusEntryRelationshipRandomValue.GetRandomCensusEntryRelationship;
+import static scot.carricksoftware.grants.GenerateCensusEntryRandomEnums.GetRandomCensusEntryCondition;
+import static scot.carricksoftware.grants.GenerateCensusEntryRandomEnums.GetRandomCensusEntryRelationship;
 
 class CensusEntryCommandEnumTest {
 

+ 2 - 2
src/test/java/scot/carricksoftware/grants/converters/census/CensusEntryCommandConverterTest.java

@@ -16,8 +16,8 @@ import scot.carricksoftware.grants.enums.censusentry.CensusEntryCondition;
 import scot.carricksoftware.grants.enums.censusentry.CensusEntryRelationship;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static scot.carricksoftware.grants.GenerateCensusEntryConditionRandomValue.GetRandomCensusEntryCondition;
-import static scot.carricksoftware.grants.GenerateCensusEntryRelationshipRandomValue.GetRandomCensusEntryRelationship;
+import static scot.carricksoftware.grants.GenerateCensusEntryRandomEnums.GetRandomCensusEntryCondition;
+import static scot.carricksoftware.grants.GenerateCensusEntryRandomEnums.GetRandomCensusEntryRelationship;
 import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
 import static scot.carricksoftware.grants.GenerateRandomCensusValues.GetRandomCensus;
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;

+ 2 - 2
src/test/java/scot/carricksoftware/grants/converters/census/CensusEntryConverterTest.java

@@ -15,8 +15,8 @@ import scot.carricksoftware.grants.enums.censusentry.CensusEntryRelationship;
 import scot.carricksoftware.grants.enums.censusentry.CensusEntryCondition;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static scot.carricksoftware.grants.GenerateCensusEntryConditionRandomValue.GetRandomCensusEntryCondition;
-import static scot.carricksoftware.grants.GenerateCensusEntryRelationshipRandomValue.GetRandomCensusEntryRelationship;
+import static scot.carricksoftware.grants.GenerateCensusEntryRandomEnums.GetRandomCensusEntryCondition;
+import static scot.carricksoftware.grants.GenerateCensusEntryRandomEnums.GetRandomCensusEntryRelationship;
 import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
 import static scot.carricksoftware.grants.GenerateRandomCensusValues.GetRandomCensus;
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;

+ 14 - 2
src/test/java/scot/carricksoftware/grants/domains/census/CensusEntryEnumTest.java

@@ -11,11 +11,11 @@ import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.junit.jupiter.MockitoExtension;
 import scot.carricksoftware.grants.enums.censusentry.CensusEntryCondition;
 import scot.carricksoftware.grants.enums.censusentry.CensusEntryRelationship;
+import scot.carricksoftware.grants.enums.censusentry.CensusEntryGaelic;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
-import static scot.carricksoftware.grants.GenerateCensusEntryConditionRandomValue.GetRandomCensusEntryCondition;
-import static scot.carricksoftware.grants.GenerateCensusEntryRelationshipRandomValue.GetRandomCensusEntryRelationship;
+import static scot.carricksoftware.grants.GenerateCensusEntryRandomEnums.*;
 
 @ExtendWith(MockitoExtension.class)
 class CensusEntryEnumTest {
@@ -51,4 +51,16 @@ class CensusEntryEnumTest {
         assertEquals(condition, entry.getCondition());
     }
 
+    @Test
+    void getGaelicTest() {
+        assertNull(entry.getCondition());
+    }
+
+    @Test
+    void setGaelicTest() {
+        CensusEntryGaelic gaelic = GetRandomCensusEntryGaelic();
+        entry.setGaelic(gaelic);
+        assertEquals(gaelic, entry.getGaelic());
+    }
+
 }