瀏覽代碼

place text and place images command

Andrew Grant 7 月之前
父節點
當前提交
447affcd30

+ 10 - 0
src/main/java/scot/carricksoftware/grants/commands/places/places/PlaceCommand.java

@@ -7,7 +7,9 @@ package scot.carricksoftware.grants.commands.places.places;
 
 
 import scot.carricksoftware.grants.domains.census.Census;
+import scot.carricksoftware.grants.domains.images.PlaceImage;
 import scot.carricksoftware.grants.domains.places.Region;
+import scot.carricksoftware.grants.domains.text.PlaceText;
 
 import java.util.List;
 
@@ -32,4 +34,12 @@ public interface PlaceCommand {
     List<Census> getCensuses();
 
     void setCensuses(List<Census> censuses);
+
+    List<PlaceImage> getPlaceImages();
+
+    void setPlaceImages(List<PlaceImage> placeImages);
+
+    List<PlaceText> getPlaceTexts();
+
+    void setPlaceTexts(List<PlaceText> placeTexts);
 }

+ 26 - 0
src/main/java/scot/carricksoftware/grants/commands/places/places/PlaceCommandImpl.java

@@ -6,7 +6,9 @@
 package scot.carricksoftware.grants.commands.places.places;
 
 import scot.carricksoftware.grants.domains.census.Census;
+import scot.carricksoftware.grants.domains.images.PlaceImage;
 import scot.carricksoftware.grants.domains.places.Region;
+import scot.carricksoftware.grants.domains.text.PlaceText;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -21,6 +23,10 @@ public class PlaceCommandImpl implements PlaceCommand {
 
     private List<Census> censuses = new ArrayList<>();
 
+    private List<PlaceImage> placeImages = new ArrayList<>();
+
+    private List<PlaceText> placeTexts = new ArrayList<>();
+
 
     @Override
     public Long getId() {
@@ -61,4 +67,24 @@ public class PlaceCommandImpl implements PlaceCommand {
     public void setCensuses(List<Census> censuses) {
         this.censuses = censuses;
     }
+
+    @Override
+    public List<PlaceImage> getPlaceImages() {
+        return placeImages;
+    }
+
+    @Override
+    public void setPlaceImages(List<PlaceImage> placeImages) {
+        this.placeImages = placeImages;
+    }
+
+    @Override
+    public List<PlaceText> getPlaceTexts() {
+        return placeTexts;
+    }
+
+    @Override
+    public void setPlaceTexts(List<PlaceText> placeTexts) {
+        this.placeTexts = placeTexts;
+    }
 }

+ 25 - 0
src/test/java/scot/carricksoftware/grants/commands/places/PlaceCommandTest.java

@@ -11,13 +11,17 @@ import org.junit.jupiter.api.Test;
 import static org.junit.jupiter.api.Assertions.*;
 import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
 import static scot.carricksoftware.grants.GenerateRandomCensusValues.GetRandomCensus;
+import static scot.carricksoftware.grants.GenerateRandomImageValues.GetRandomPlaceImage;
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
 import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomRegion;
+import static scot.carricksoftware.grants.GenerateRandomTextValues.GetRandomPlaceText;
 
 import scot.carricksoftware.grants.commands.places.places.PlaceCommand;
 import scot.carricksoftware.grants.commands.places.places.PlaceCommandImpl;
 import scot.carricksoftware.grants.domains.census.Census;
+import scot.carricksoftware.grants.domains.images.PlaceImage;
 import scot.carricksoftware.grants.domains.places.Region;
+import scot.carricksoftware.grants.domains.text.PlaceText;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -81,5 +85,26 @@ public class PlaceCommandTest {
         assertEquals(censuses, command.getCensuses());
     }
 
+    @Test
+    public void setPlaceImagesTest() {
+        List<PlaceImage> placeImages = new ArrayList<>();
+        placeImages.add(GetRandomPlaceImage());
+        command.setPlaceImages(placeImages);
+        assertEquals(placeImages, command.getPlaceImages());
+    }
+
+    @Test
+    public void getPLaceTextsTest() {
+        assertTrue(command.getPlaceTexts().isEmpty());
+    }
+
+    @Test
+    public void setPlaceTextsTest() {
+        List<PlaceText> placeTexts = new ArrayList<>();
+        placeTexts.add(GetRandomPlaceText());
+        command.setPlaceTexts(placeTexts);
+        assertEquals(placeTexts, command.getPlaceTexts());
+    }
+
 
 }