Procházet zdrojové kódy

CensusEntry Sex Enum in command

Andrew Grant před 7 měsíci
rodič
revize
2d74865fc8

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

@@ -7,10 +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.CensusEntryCondition;
-import scot.carricksoftware.grants.enums.censusentry.CensusEntryGaelic;
-import scot.carricksoftware.grants.enums.censusentry.CensusEntryRelationship;
-import scot.carricksoftware.grants.enums.censusentry.CensusEntryWorker;
+import scot.carricksoftware.grants.enums.censusentry.*;
 
 public interface CensusEntryCommand {
 
@@ -53,4 +50,8 @@ public interface CensusEntryCommand {
     String getWhereBorn();
 
     void setWhereBorn(String whereBorn);
+
+    CensusEntrySex getSex();
+
+    void setSex(CensusEntrySex sex);
 }

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

@@ -7,10 +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;
-import scot.carricksoftware.grants.enums.censusentry.CensusEntryWorker;
+import scot.carricksoftware.grants.enums.censusentry.*;
 
 public class CensusEntryCommandImpl implements CensusEntryCommand {
 
@@ -34,6 +31,8 @@ public class CensusEntryCommandImpl implements CensusEntryCommand {
 
     private String whereBorn;
 
+    private CensusEntrySex Sex;
+
     public Long getId() {
         return id;
     }
@@ -131,4 +130,14 @@ public class CensusEntryCommandImpl implements CensusEntryCommand {
     public void setWhereBorn(String whereBorn) {
         this.whereBorn = whereBorn;
     }
+
+    @Override
+    public CensusEntrySex getSex() {
+        return Sex;
+    }
+
+    @Override
+    public void setSex(CensusEntrySex sex) {
+        Sex = sex;
+    }
 }

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

@@ -8,10 +8,7 @@ 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 scot.carricksoftware.grants.enums.censusentry.CensusEntryWorker;
+import scot.carricksoftware.grants.enums.censusentry.*;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
@@ -74,4 +71,17 @@ class CensusEntryCommandEnumTest {
         assertEquals(worker, command.getWorker());
     }
 
+    @Test
+    void getSexTest() {
+        assertNull(command.getSex());
+    }
+
+    @Test
+    void setSexTest() {
+        CensusEntrySex sex = GetRandomCensusEntrySex();
+        command.setSex(sex);
+        assertEquals(sex, command.getSex());
+    }
+
+
 }