Browse Source

Rooms Occupied, Inhabited Houses, Uninhabited Houses to domain

Andrew Grant 6 months ago
parent
commit
e1ebcc4f93

+ 33 - 0
src/main/java/scot/carricksoftware/grants/domains/census/Census.java

@@ -53,6 +53,15 @@ public class Census extends BaseEntity {
     @Column(name = "`total_rooms`")
     private String totalRooms;
 
+    @Column(name= "`rooms_occupied`")
+    private String roomsOccupied;
+
+    @Column(name = "`inhabited_houses`")
+    private String inhabitedHouses;
+
+    @Column(name = "`uninhabited_houses`")
+    private String uninhabitedHouses;
+
     public CensusDate getCensusDate() {
         return censusDate;
     }
@@ -122,4 +131,28 @@ public class Census extends BaseEntity {
     public void setTotalRooms(String totalRooms) {
         this.totalRooms = totalRooms;
     }
+
+    public String getRoomsOccupied() {
+        return roomsOccupied;
+    }
+
+    public void setRoomsOccupied(String roomsOccupied) {
+        this.roomsOccupied = roomsOccupied;
+    }
+
+    public String getInhabitedHouses() {
+        return inhabitedHouses;
+    }
+
+    public void setInhabitedHouses(String inhabitedHouses) {
+        this.inhabitedHouses = inhabitedHouses;
+    }
+
+    public String getUninhabitedHouses() {
+        return uninhabitedHouses;
+    }
+
+    public void setUninhabitedHouses(String uninhabitedHouses) {
+        this.uninhabitedHouses = uninhabitedHouses;
+    }
 }

+ 1 - 1
src/main/resources/application.properties

@@ -2,7 +2,7 @@ spring.application.name=grants
 server.port=8086
 server.servlet.context-path=/grants
 spring.mvc.format.date=dd-MM-yyyy
-spring.profiles.active=uat
+spring.profiles.active=dev
 logging.level.scot.carricksoftware=trace
 
 

+ 1 - 24
src/test/java/scot/carricksoftware/grants/domains/census/CensusTest.java → src/test/java/scot/carricksoftware/grants/domains/census/CensusPartOneTest.java

@@ -25,7 +25,7 @@ import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLo
 import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomPlace;
 
 @ExtendWith(MockitoExtension.class)
-public class CensusTest {
+public class CensusPartOneTest {
 
     private Census census;
 
@@ -85,29 +85,6 @@ public class CensusTest {
         assertEquals(placeString + ", " + censusDate.label, census.toString());
     }
 
-    @Test
-    public void getFilledInByTest() {
-        assertNull(census.getFilledInBy());
-    }
-
-    @Test
-    public void setFilledInByTest() {
-        String filledInBy = GetRandomString();
-        census.setFilledInBy(filledInBy);
-        assertEquals(filledInBy, census.getFilledInBy());
-    }
-
-    @Test
-    public void getTotalRoomsTest() {
-        assertNull(census.getTotalRooms());
-    }
-
-    @Test
-    public void setTotalRoomsTest() {
-        String totalRooms = GetRandomString();
-        census.setTotalRooms(totalRooms);
-        assertEquals(totalRooms, census.getTotalRooms());
-    }
 
 
 }

+ 91 - 0
src/test/java/scot/carricksoftware/grants/domains/census/CensusPartTwoTest.java

@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) Andrew Grant of Carrick Software 19/03/2025, 01:42. All rights reserved.
+ *
+ */
+
+package scot.carricksoftware.grants.domains.census;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
+
+
+@ExtendWith(MockitoExtension.class)
+public class CensusPartTwoTest {
+
+    private Census census;
+
+    @BeforeEach
+    public void setUp() {
+        census = new Census();
+    }
+
+
+    @Test
+    public void getFilledInByTest() {
+        assertNull(census.getFilledInBy());
+    }
+
+    @Test
+    public void setFilledInByTest() {
+        String filledInBy = GetRandomString();
+        census.setFilledInBy(filledInBy);
+        assertEquals(filledInBy, census.getFilledInBy());
+    }
+
+    @Test
+    public void getTotalRoomsTest() {
+        assertNull(census.getTotalRooms());
+    }
+
+    @Test
+    public void setTotalRoomsTest() {
+        String totalRooms = GetRandomString();
+        census.setTotalRooms(totalRooms);
+        assertEquals(totalRooms, census.getTotalRooms());
+    }
+
+    @Test
+    public void getRoomsOccupiedTest() {
+        assertNull(census.getRoomsOccupied());
+    }
+
+    @Test
+    public void setRoomOccupiedTest() {
+        String roomsOccupied = GetRandomString();
+        census.setRoomsOccupied(roomsOccupied);
+        assertEquals(roomsOccupied, census.getRoomsOccupied());
+    }
+
+    @Test
+    public void getInhabitedHousesTest() {
+        assertNull(census.getInhabitedRooms());
+    }
+
+    @Test
+    public void setInhabitedHousesTest() {
+        String inhabitedHouses = GetRandomString();
+        census.setInhabitedHouses(inhabitedHouses);
+        assertEquals(inhabitedHouses, census.getInhabitedHouses());
+    }
+
+
+    @Test
+    public void getUninhabitedHousesTest() {
+        assertNull(census.getUninhabitedHouses());
+    }
+
+    @Test
+    public void setUninhabitedHousesTest() {
+        String uninhabitedHouses = GetRandomString();
+        census.setUninhabitedHouses(uninhabitedHouses);
+        assertEquals(uninhabitedHouses, census.getUninhabitedHouses());
+    }
+
+
+}