Browse Source

PersonImage Converter Tests

Andrew Grant 1 month ago
parent
commit
9353bc9d01

+ 22 - 0
src/test/java/scot/carricksoftware/grants/converters/images/personimage/PersonImageCommandConverterTest.java

@@ -9,11 +9,13 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import scot.carricksoftware.grants.commands.images.PersonImageCommand;
 import scot.carricksoftware.grants.commands.images.PersonImageCommandImpl;
+import scot.carricksoftware.grants.domains.images.Image;
 import scot.carricksoftware.grants.domains.images.PersonImage;
 import scot.carricksoftware.grants.domains.people.Person;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
 import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
 
@@ -30,10 +32,24 @@ class PersonImageCommandConverterTest {
     void covertTest() {
         Long Id = GetRandomLong();
         Person person = GetRandomPerson();
+        Image image = new Image();
+        String level = GetRandomString();
+        String order = GetRandomString();
+        String caption = GetRandomString();
+        String height = GetRandomString();
+        String width = GetRandomString();
+
+
         PersonImageCommand source = new PersonImageCommandImpl();
 
         source.setPerson(person);
         source.setId(Id);
+        source.setImage(image);
+        source.setLevel(level);
+        source.setOrder(order);
+        source.setCaption(caption);
+        source.setHeight(height);
+        source.setWidth(width);
 
 
         PersonImage target = converter.convert(source);
@@ -41,5 +57,11 @@ class PersonImageCommandConverterTest {
         assertNotNull(target);
         assertEquals(Id, target.getId());
         assertEquals(person, target.getPerson());
+        assertEquals(image, target.getImage());
+        assertEquals(level, target.getLevel());
+        assertEquals(order, target.getOrder());
+        assertEquals(caption, target.getCaption());
+        assertEquals(height, target.getHeight());
+        assertEquals(width, target.getWidth());
     }
 }

+ 21 - 0
src/test/java/scot/carricksoftware/grants/converters/images/personimage/PersonImageConverterTest.java

@@ -8,11 +8,13 @@ package scot.carricksoftware.grants.converters.images.personimage;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import scot.carricksoftware.grants.commands.images.PersonImageCommand;
+import scot.carricksoftware.grants.domains.images.Image;
 import scot.carricksoftware.grants.domains.images.PersonImage;
 import scot.carricksoftware.grants.domains.people.Person;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
 import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
 
@@ -29,16 +31,35 @@ class PersonImageConverterTest {
     void covertTest() {
         Long Id = GetRandomLong();
         Person person = GetRandomPerson();
+        Image image = new Image();
+        String level = GetRandomString();
+        String order = GetRandomString();
+        String caption = GetRandomString();
+        String height = GetRandomString();
+        String width = GetRandomString();
 
         PersonImage source = new PersonImage();
 
         source.setId(Id);
         source.setPerson(person);
+        source.setImage(image);
+        source.setLevel(level);
+        source.setOrder(order);
+        source.setCaption(caption);
+        source.setHeight(height);
+        source.setWidth(width);
 
         PersonImageCommand target = converter.convert(source);
 
         assertNotNull(target);
         assertEquals(Id, target.getId());
         assertEquals(person, target.getPerson());
+        assertEquals(image, target.getImage());
+        assertEquals(level, target.getLevel());
+        assertEquals(order, target.getOrder());
+        assertEquals(caption, target.getCaption());
+        assertEquals(height, target.getHeight());
+        assertEquals(width, target.getWidth());
+
     }
 }