Browse Source

Five attributes added to CensusEntry command

Andrew Grant 7 months ago
parent
commit
ae3ed0f952

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

@@ -70,4 +70,20 @@ public interface CensusEntryCommand {
     String getNotes();
 
     void setNotes(String notes);
+
+    String getChildrenWhoHaveDied();
+
+    void setChildrenWhoHaveDied(String childrenWhoHaveDied);
+
+    String getChildrenStillAlive();
+
+    void setChildrenStillAlive(String childrenStillAlive);
+
+    String getChildrenBornAlive();
+
+    void setChildrenBornAlive(String childrenBornAlive);
+
+    String getYearsCompletedMarriage();
+
+    void setYearsCompletedMarriage(String yearsCompletedMarriage);
 }

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

@@ -41,6 +41,13 @@ public class CensusEntryCommandImpl implements CensusEntryCommand {
 
     private String notes;
 
+    private String childrenWhoHaveDied;
+
+    private String childrenStillAlive;
+
+    private String childrenBornAlive;
+
+    private String yearsCompletedMarriage;
 
     public Long getId() {
         return id;
@@ -189,4 +196,44 @@ public class CensusEntryCommandImpl implements CensusEntryCommand {
     public void setNotes(String notes) {
         this.notes = notes;
     }
+
+    @Override
+    public String getChildrenWhoHaveDied() {
+        return childrenWhoHaveDied;
+    }
+
+    @Override
+    public void setChildrenWhoHaveDied(String childrenWhoHaveDied) {
+        this.childrenWhoHaveDied = childrenWhoHaveDied;
+    }
+
+    @Override
+    public String getChildrenStillAlive() {
+        return childrenStillAlive;
+    }
+
+    @Override
+    public void setChildrenStillAlive(String childrenStillAlive) {
+        this.childrenStillAlive = childrenStillAlive;
+    }
+
+    @Override
+    public String getChildrenBornAlive() {
+        return childrenBornAlive;
+    }
+
+    @Override
+    public void setChildrenBornAlive(String childrenBornAlive) {
+        this.childrenBornAlive = childrenBornAlive;
+    }
+
+    @Override
+    public String getYearsCompletedMarriage() {
+        return yearsCompletedMarriage;
+    }
+
+    @Override
+    public void setYearsCompletedMarriage(String yearsCompletedMarriage) {
+        this.yearsCompletedMarriage = yearsCompletedMarriage;
+    }
 }

+ 85 - 0
src/test/java/scot/carricksoftware/grants/commands/census/CensusEntryCommandPartOneTest.java

@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) Andrew Grant of Carrick Software 20/03/2025, 11:15. All rights reserved.
+ *
+ */
+
+package scot.carricksoftware.grants.commands.census;
+
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
+import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
+
+class CensusEntryCommandPartOneTest {
+
+    private CensusEntryCommand command;
+
+    @BeforeEach
+    void setUp() {
+        command = new CensusEntryCommandImpl();
+    }
+
+    @Test
+    void setIdTest() {
+        Long id = GetRandomLong();
+        command.setId(id);
+        assertEquals(id, command.getId());
+    }
+
+    @Test
+    void getNameTest() {
+        assertNull(command.getName());
+    }
+
+    @Test
+    void setNameTest() {
+        String name = GetRandomString();
+        command.setName(name);
+        assertEquals(name, command.getName());
+    }
+
+    @Test
+    void getBirthDayTest() {
+        assertNull(command.getBirthDay());
+    }
+
+    @Test
+    void setBirthDayTest() {
+        String birthDay = GetRandomString();
+        command.setBirthDay(birthDay);
+        assertEquals(birthDay, command.getBirthDay());
+    }
+
+    @Test
+    void getBirthYearTest() {
+        assertNull(command.getBirthYear());
+    }
+
+    @Test
+    void setBirthYearTest() {
+        String birthYear = GetRandomString();
+        command.setBirthYear(birthYear);
+        assertEquals(birthYear, command.getBirthYear());
+    }
+
+    @Test
+    void getPersonalOccupationTest() {
+        assertNull(command.getPersonalOccupation());
+    }
+
+    @Test
+    void setPersonalOccupationTest() {
+        String personalOccupation = GetRandomString();
+        command.setPersonalOccupation(personalOccupation);
+        assertEquals(personalOccupation, command.getPersonalOccupation());
+    }
+
+
+
+
+
+}

+ 75 - 0
src/test/java/scot/carricksoftware/grants/commands/census/CensusEntryCommandPartThreeTest.java

@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) Andrew Grant of Carrick Software 20/03/2025, 11:15. All rights reserved.
+ *
+ */
+
+package scot.carricksoftware.grants.commands.census;
+
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
+
+class CensusEntryCommandPartThreeTest {
+
+    private CensusEntryCommand entry;
+
+    @BeforeEach
+    void setUp() {
+        entry = new CensusEntryCommandImpl();
+    }
+
+    @Test
+    public void getChildrenWhoHaveDiedTest() {
+        assertNull(entry.getChildrenWhoHaveDied());
+    }
+
+    @Test
+    public void setChildrenWhoHaveDiedTest() {
+        String string = GetRandomString();
+        entry.setChildrenWhoHaveDied(string);
+        assertEquals(string, entry.getChildrenWhoHaveDied());
+    }
+
+    @Test
+    public void getChildrenStillAliveTest() {
+        assertNull(entry.getChildrenStillAlive());
+    }
+
+    @Test
+    public void setChildrenStillAliveTest() {
+        String string = GetRandomString();
+        entry.setChildrenStillAlive(string);
+        assertEquals(string, entry.getChildrenStillAlive());
+    }
+
+    @Test
+    public void getChildrenBornAliveTest() {
+        assertNull(entry.getChildrenBornAlive());
+    }
+
+    @Test
+    public void setChildrenBornAliveTest() {
+        String string = GetRandomString();
+        entry.setChildrenBornAlive(string);
+        assertEquals(string, entry.getChildrenBornAlive());
+    }
+
+    @Test
+    public void getYearsCompletedMarriageTest() {
+        assertNull(entry.getYearsCompletedMarriage());
+    }
+
+    @Test
+    public void setYearsCompletedMarriageTest() {
+        String string = GetRandomString();
+        entry.setYearsCompletedMarriage(string);
+        assertEquals(string, entry.getYearsCompletedMarriage());
+    }
+
+
+
+}

+ 9 - 55
src/test/java/scot/carricksoftware/grants/commands/census/CensusEntryCommandTest.java → src/test/java/scot/carricksoftware/grants/commands/census/CensusEntryCommandPartTwoTest.java

@@ -11,7 +11,6 @@ import org.junit.jupiter.api.Test;
 import scot.carricksoftware.grants.domains.census.Census;
 import scot.carricksoftware.grants.domains.people.Person;
 
-
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
@@ -19,7 +18,7 @@ import static scot.carricksoftware.grants.GenerateRandomCensusValues.GetRandomCe
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
 import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
 
-class CensusEntryCommandTest {
+class CensusEntryCommandPartTwoTest {
 
     private CensusEntryCommand command;
 
@@ -29,22 +28,23 @@ class CensusEntryCommandTest {
     }
 
     @Test
-    void setId() {
+    void setIdTest() {
         Long id = GetRandomLong();
         command.setId(id);
         assertEquals(id, command.getId());
     }
 
+
     @Test
-    void getNameTest() {
-        assertNull(command.getName());
+    void getNotesTest() {
+        assertNull(command.getNotes());
     }
 
     @Test
-    void setNameTest() {
-        String name = GetRandomString();
-        command.setName(name);
-        assertEquals(name, command.getName());
+    void setNotesTest() {
+        String notes = GetRandomString();
+        command.setNotes(notes);
+        assertEquals(notes, command.getNotes());
     }
 
     @Test
@@ -94,53 +94,7 @@ class CensusEntryCommandTest {
         command.setWhereBorn(whereBorn);
         assertEquals(whereBorn, command.getWhereBorn());
     }
-    
-    @Test
-    void getBirthDayTest() {
-        assertNull(command.getBirthDay());
-    }
 
-    @Test
-    void setBirthDayTest() {
-        String birthDay = GetRandomString();
-        command.setBirthDay(birthDay);
-        assertEquals(birthDay, command.getBirthDay());
-    }
-
-    @Test
-    void getBirthYearTest() {
-        assertNull(command.getBirthYear());
-    }
-
-    @Test
-    void setBirthYearTest() {
-        String birthYear = GetRandomString();
-        command.setBirthYear(birthYear);
-        assertEquals(birthYear, command.getBirthYear());
-    }
-
-    @Test
-    void getPersonalOccupationTest() {
-        assertNull(command.getPersonalOccupation());
-    }
-
-    @Test
-    void setPersonalOccupationTest() {
-        String personalOccupation = GetRandomString();
-        command.setPersonalOccupation(personalOccupation);
-        assertEquals(personalOccupation, command.getPersonalOccupation());
-    }
-    @Test
-    void getNotesTest() {
-        assertNull(command.getNotes());
-    }
-
-    @Test
-    void setNotesTest() {
-        String notes = GetRandomString();
-        command.setNotes(notes);
-        assertEquals(notes, command.getNotes());
-    }