Эх сурвалжийг харах

Census Boundary Type added to command

Andrew Grant 7 сар өмнө
parent
commit
e6520c19b5

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

@@ -7,6 +7,7 @@ package scot.carricksoftware.grants.commands.census;
 
 import scot.carricksoftware.grants.domains.census.CensusEntry;
 import scot.carricksoftware.grants.domains.places.Place;
+import scot.carricksoftware.grants.enums.census.CensusBoundaryType;
 
 import java.time.LocalDate;
 import java.util.List;
@@ -27,4 +28,8 @@ public interface CensusCommand {
     Place getPlace();
 
     void setPlace(Place place);
+
+    CensusBoundaryType getBoundaryType();
+
+    void setBoundaryType(CensusBoundaryType boundaryType);
 }

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

@@ -7,6 +7,7 @@ package scot.carricksoftware.grants.commands.census;
 
 import scot.carricksoftware.grants.domains.census.CensusEntry;
 import scot.carricksoftware.grants.domains.places.Place;
+import scot.carricksoftware.grants.enums.census.CensusBoundaryType;
 
 import java.time.LocalDate;
 import java.util.ArrayList;
@@ -22,6 +23,8 @@ public class CensusCommandImpl implements CensusCommand {
 
     private Place place;
 
+    private CensusBoundaryType boundaryType;
+
     @Override
     public Long getId() {
         return id;
@@ -61,4 +64,14 @@ public class CensusCommandImpl implements CensusCommand {
     public void setPlace(Place place) {
         this.place = place;
     }
+
+    @Override
+    public CensusBoundaryType getBoundaryType() {
+        return boundaryType;
+    }
+
+    @Override
+    public void setBoundaryType(CensusBoundaryType boundaryType) {
+        this.boundaryType = boundaryType;
+    }
 }

+ 2 - 2
src/main/java/scot/carricksoftware/grants/enums/census/CensusBoundaryType.java

@@ -9,8 +9,8 @@ public enum CensusBoundaryType {
 
     CIVIL_PARISH("Civil Parish"),
     PARISH_WARD("Parish Ward"),
-    ECCLESIASTICAL_PARISH("Ecclesical Parish"),
-    QUOAD_SACRA__PARISH ("Quoad Sacra Parish"),
+    @SuppressWarnings("SpellCheckingInspection") ECCLESIASTICAL_PARISH("Ecclesical Parish"),
+    @SuppressWarnings("SpellCheckingInspection") QUOAD_SACRA__PARISH ("Quoad Sacra Parish"),
     SCHOOL_BOARD_DISTRICT ("School Board District"),
     PARLIAMENTARY_BURGH  ("Parliamentary Burgh"),
     PARLIAMENTARY_DIVISION("Parliamentary Division"),

+ 40 - 0
src/test/java/scot/carricksoftware/grants/commands/census/CensusCommandEnumTest.java

@@ -0,0 +1,40 @@
+/*
+ * 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 scot.carricksoftware.grants.enums.census.CensusBoundaryType;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static scot.carricksoftware.grants.GenerateCensusRandomEnums.GetRandomCensusBoundaryType;
+
+class CensusCommandEnumTest {
+
+    private CensusCommand command;
+
+    @BeforeEach
+    void setUp() {
+        command = new CensusCommandImpl();
+    }
+
+    @Test
+    void getBoundaryType() {
+        assertNull(command.getBoundaryType());
+    }
+
+    @Test
+    void setBoundaryTypeTest() {
+        CensusBoundaryType boundaryType = GetRandomCensusBoundaryType();
+        command.setBoundaryType(boundaryType);
+        assertEquals(boundaryType, command.getBoundaryType());
+    }
+
+
+
+}