Kaynağa Gözat

CensusEntry Gaelic added to command

Andrew Grant 5 ay önce
ebeveyn
işleme
675b4017f6

+ 5 - 0
src/main/java/scot/carricksoftware/grants/commands/census/CensusEntryCommand.java

@@ -8,6 +8,7 @@ package scot.carricksoftware.grants.commands.census;
 import scot.carricksoftware.grants.domains.census.Census;
 import scot.carricksoftware.grants.domains.people.Person;
 import scot.carricksoftware.grants.enums.censusentry.CensusEntryCondition;
+import scot.carricksoftware.grants.enums.censusentry.CensusEntryGaelic;
 import scot.carricksoftware.grants.enums.censusentry.CensusEntryRelationship;
 
 public interface CensusEntryCommand {
@@ -35,4 +36,8 @@ public interface CensusEntryCommand {
     CensusEntryCondition getCondition();
 
     void setCondition(CensusEntryCondition condition);
+
+    CensusEntryGaelic getGaelic();
+
+    void setGaelic(CensusEntryGaelic gaelic);
 }

+ 13 - 0
src/main/java/scot/carricksoftware/grants/commands/census/CensusEntryCommandImpl.java

@@ -7,6 +7,7 @@ package scot.carricksoftware.grants.commands.census;
 
 import scot.carricksoftware.grants.domains.census.Census;
 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;
 
@@ -24,6 +25,8 @@ public class CensusEntryCommandImpl implements CensusEntryCommand {
 
     private CensusEntryCondition condition;
 
+    private CensusEntryGaelic gaelic;
+
     public Long getId() {
         return id;
     }
@@ -81,4 +84,14 @@ public class CensusEntryCommandImpl implements CensusEntryCommand {
     public void setCondition(CensusEntryCondition condition) {
         this.condition = condition;
     }
+
+    @Override
+    public CensusEntryGaelic getGaelic() {
+        return gaelic;
+    }
+
+    @Override
+    public void setGaelic(CensusEntryGaelic gaelic) {
+        this.gaelic = gaelic;
+    }
 }

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

@@ -31,7 +31,7 @@ public class CensusEntry extends BaseEntity {
     private CensusEntryRelationship relationship;
 
     @Enumerated(EnumType.STRING)
-    private CensusEntryGaelic Gaelic;
+    private CensusEntryGaelic gaelic;
 
     @Enumerated(EnumType.STRING)
     private CensusEntryCondition condition;
@@ -81,10 +81,10 @@ public class CensusEntry extends BaseEntity {
     }
 
     public CensusEntryGaelic getGaelic() {
-        return Gaelic;
+        return this.gaelic;
     }
 
     public void setGaelic(CensusEntryGaelic gaelic) {
-        Gaelic = gaelic;
+        this.gaelic = gaelic;
     }
 }

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

@@ -7,7 +7,7 @@ package scot.carricksoftware.grants.enums.censusentry;
 
 public enum CensusEntryGaelic {
     @SuppressWarnings("unused") GAELIC("Gaelic"),
-    @SuppressWarnings("unused") GAELICANDENGLISH("Gaelic and English");
+    @SuppressWarnings({"unused", "SpellCheckingInspection"}) GAELICANDENGLISH("Gaelic and English");
 
     @SuppressWarnings("unused")
     public final String label;

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

@@ -9,12 +9,12 @@ package scot.carricksoftware.grants.commands.census;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import scot.carricksoftware.grants.enums.censusentry.CensusEntryCondition;
+import scot.carricksoftware.grants.enums.censusentry.CensusEntryGaelic;
 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.GenerateCensusEntryRandomEnums.GetRandomCensusEntryCondition;
-import static scot.carricksoftware.grants.GenerateCensusEntryRandomEnums.GetRandomCensusEntryRelationship;
+import static scot.carricksoftware.grants.GenerateCensusEntryRandomEnums.*;
 
 class CensusEntryCommandEnumTest {
 
@@ -49,6 +49,16 @@ class CensusEntryCommandEnumTest {
         assertEquals(condition, command.getCondition());
     }
 
+    @Test
+    void getGaelicTest() {
+        assertNull(command.getGaelic());
+    }
 
+    @Test
+    void setGaelicTest() {
+        CensusEntryGaelic gaelic = GetRandomCensusEntryGaelic();
+        command.setGaelic(gaelic);
+        assertEquals(gaelic, command.getGaelic());
+    }
 
 }