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

Rooms added to Census Converters

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

+ 3 - 0
src/main/java/scot/carricksoftware/grants/converters/census/CensusCommandConverterImpl.java

@@ -12,6 +12,7 @@ import scot.carricksoftware.grants.domains.census.Census;
 @Component
 public class CensusCommandConverterImpl implements CensusCommandConverter {
 
+    @SuppressWarnings("DuplicatedCode")
     @Override
     public Census convert(CensusCommand source) {
         Census result = new Census();
@@ -21,6 +22,8 @@ public class CensusCommandConverterImpl implements CensusCommandConverter {
         result.setPlace(source.getPlace());
         result.setBoundaryType(source.getBoundaryType());
         result.setCensusDate(source.getCensusDate());
+        result.setInhabitedRooms(source.getInhabitedRooms());
+        result.setRoomsWithWindows(source.getRoomsWithWindows());
 
 
         return result;

+ 3 - 0
src/main/java/scot/carricksoftware/grants/converters/census/CensusConverterImpl.java

@@ -13,6 +13,7 @@ import scot.carricksoftware.grants.domains.census.Census;
 @Component
 public class CensusConverterImpl implements CensusConverter {
 
+    @SuppressWarnings("DuplicatedCode")
     @Override
     public CensusCommand convert(Census source) {
         CensusCommand result = new CensusCommandImpl();
@@ -21,6 +22,8 @@ public class CensusConverterImpl implements CensusConverter {
         result.setPlace(source.getPlace());
         result.setBoundaryType(source.getBoundaryType());
         result.setCensusDate(source.getCensusDate());
+        result.setInhabitedRooms(source.getInhabitedRooms());
+        result.setRoomsWithWindows(source.getRoomsWithWindows());
         return result;
     }
 }

+ 7 - 0
src/test/java/scot/carricksoftware/grants/converters/census/CensusCommandConverterTest.java

@@ -21,6 +21,7 @@ import java.util.List;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static scot.carricksoftware.grants.GenerateCensusRandomEnums.GetRandomCensusBoundaryType;
 import static scot.carricksoftware.grants.GenerateCensusRandomEnums.GetRandomCensusDate;
+import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
 import static scot.carricksoftware.grants.GenerateRandomCensusValues.GetRandomCensusEntry;
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
 import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomPlace;
@@ -42,12 +43,16 @@ class CensusCommandConverterTest {
         censusEntries.add(GetRandomCensusEntry());
         Place place = GetRandomPlace();
         CensusBoundaryType boundaryType = GetRandomCensusBoundaryType();
+        String roomsWithWindows = GetRandomString();
+        String inhabitedRooms = GetRandomString();
 
         source.setId(id);
         source.setCensusDate(censusDate);
         source.setCensusEntries(censusEntries);
         source.setPlace(place);
         source.setBoundaryType(boundaryType);
+        source.setInhabitedRooms(inhabitedRooms);
+        source.setRoomsWithWindows(roomsWithWindows);
 
         Census target = converter.convert(source);
 
@@ -57,5 +62,7 @@ class CensusCommandConverterTest {
         assertEquals(place, target.getPlace());
         assertEquals(boundaryType, target.getBoundaryType());
         assertEquals(censusDate, target.getCensusDate());
+        assertEquals(roomsWithWindows, target.getRoomsWithWindows());
+        assertEquals(inhabitedRooms, target.getInhabitedRooms());
     }
 }

+ 7 - 0
src/test/java/scot/carricksoftware/grants/converters/census/CensusConverterTest.java

@@ -20,6 +20,7 @@ import java.util.List;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static scot.carricksoftware.grants.GenerateCensusRandomEnums.GetRandomCensusBoundaryType;
 import static scot.carricksoftware.grants.GenerateCensusRandomEnums.GetRandomCensusDate;
+import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
 import static scot.carricksoftware.grants.GenerateRandomCensusValues.GetRandomCensusEntry;
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
 import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomPlace;
@@ -42,6 +43,8 @@ class CensusConverterTest {
         censusEntries.add(GetRandomCensusEntry());
         Place place = GetRandomPlace();
         CensusBoundaryType boundaryType = GetRandomCensusBoundaryType();
+        String roomsWithWindows = GetRandomString();
+        String inhabitedRooms = GetRandomString();
 
 
         source.setId(id);
@@ -49,6 +52,8 @@ class CensusConverterTest {
         source.setPlace(place);
         source.setBoundaryType(boundaryType);
         source.setCensusDate(censusDate);
+        source.setInhabitedRooms(inhabitedRooms);
+        source.setRoomsWithWindows(roomsWithWindows);
 
         CensusCommand target = converter.convert(source);
 
@@ -58,5 +63,7 @@ class CensusConverterTest {
         assertEquals(place, target.getPlace());
         assertEquals(boundaryType, target.getBoundaryType());
         assertEquals(censusDate, target.getCensusDate());
+        assertEquals(roomsWithWindows, target.getRoomsWithWindows());
+        assertEquals(inhabitedRooms, target.getInhabitedRooms());
     }
 }