Forráskód Böngészése

CensusEntryCondition in Command

Andrew Grant 5 hónapja
szülő
commit
f5369fc9b5

+ 5 - 0
src/main/java/scot/carricksoftware/grants/commands/census/CensusEntryCommand.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.CensusEntryCondition;
 import scot.carricksoftware.grants.enums.censusentry.CensusEntryRelationship;
 
 public interface CensusEntryCommand {
@@ -30,4 +31,8 @@ public interface CensusEntryCommand {
     CensusEntryRelationship getRelationship();
 
     void setRelationship(CensusEntryRelationship relationship);
+
+    CensusEntryCondition getCondition();
+
+    void setCondition(CensusEntryCondition condition);
 }

+ 13 - 0
src/main/java/scot/carricksoftware/grants/commands/census/CensusEntryCommandImpl.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.CensusEntryRelationship;
+import scot.carricksoftware.grants.enums.censusentry.CensusEntryCondition;
 
 public class CensusEntryCommandImpl implements CensusEntryCommand {
 
@@ -21,6 +22,8 @@ public class CensusEntryCommandImpl implements CensusEntryCommand {
 
     private CensusEntryRelationship relationship;
 
+    private CensusEntryCondition condition;
+
     public Long getId() {
         return id;
     }
@@ -68,4 +71,14 @@ public class CensusEntryCommandImpl implements CensusEntryCommand {
     public void setRelationship(CensusEntryRelationship relationship) {
         this.relationship = relationship;
     }
+
+    @Override
+    public CensusEntryCondition getCondition() {
+        return condition;
+    }
+
+    @Override
+    public void setCondition(CensusEntryCondition condition) {
+        this.condition = condition;
+    }
 }

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

@@ -8,10 +8,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.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;
 
 class CensusEntryCommandEnumTest {
@@ -29,10 +31,24 @@ class CensusEntryCommandEnumTest {
     }
 
     @Test
-    void setNameTest() {
+    void setRelationshipTest() {
         CensusEntryRelationship relationship = GetRandomCensusEntryRelationship();
         command.setRelationship(relationship);
         assertEquals(relationship, command.getRelationship());
+    } 
+    
+    @Test
+    void getConditionTest() {
+        assertNull(command.getCondition());
+    }
+
+    @Test
+    void setConditionTest() {
+        CensusEntryCondition condition = GetRandomCensusEntryCondition();
+        command.setCondition(condition);
+        assertEquals(condition, command.getCondition());
     }
 
+
+
 }