Browse Source

Added The other side of person relationship - converters tests

Andrew Grant 6 months ago
parent
commit
f96e127649

+ 49 - 0
src/test/java/scot/carricksoftware/grants/converters/people/PersonCommandConverterTest.java

@@ -9,7 +9,16 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import scot.carricksoftware.grants.commands.people.PersonCommand;
 import scot.carricksoftware.grants.commands.people.PersonCommandImpl;
+import scot.carricksoftware.grants.domains.census.CensusEntry;
+import scot.carricksoftware.grants.domains.certificates.BirthCertificate;
+import scot.carricksoftware.grants.domains.certificates.DeathCertificate;
+import scot.carricksoftware.grants.domains.certificates.DivorceCertificate;
+import scot.carricksoftware.grants.domains.certificates.MarriageCertificate;
+import scot.carricksoftware.grants.domains.images.PersonImage;
 import scot.carricksoftware.grants.domains.people.Person;
+import scot.carricksoftware.grants.domains.text.PersonText;
+
+import java.util.ArrayList;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
@@ -32,12 +41,43 @@ class PersonCommandConverterTest {
         String certifiedYearOfBirth = GetRandomString();
         PersonCommand source = new PersonCommandImpl();
 
+        ArrayList<DivorceCertificate> divorceCertificates = new ArrayList<>();
+        divorceCertificates.add(new DivorceCertificate());
+
+        ArrayList<PersonImage> personImages = new ArrayList<>();
+        personImages.add(new PersonImage());
+
+        ArrayList<PersonText> personTexts = new ArrayList<>();
+        personTexts.add(new PersonText());
+
+        ArrayList<CensusEntry> censusEntries = new ArrayList<>();
+        censusEntries.add(new CensusEntry());
+
+        ArrayList<DeathCertificate> deathCertificates = new ArrayList<>();
+        deathCertificates.add(new DeathCertificate());
+
+        ArrayList<BirthCertificate> birthCertificates = new ArrayList<>();
+        birthCertificates.add(new BirthCertificate());
+
+        ArrayList<MarriageCertificate> marriageCertificates = new ArrayList<>();
+        marriageCertificates.add(new MarriageCertificate());
+
+
         source.setId(id);
         source.setFirstName(firstName);
         source.setLastName(lastName);
         source.setRecordedYearOfBirth(recordedYearOfBirth);
         source.setCertifiedYearOfBirth(certifiedYearOfBirth);
 
+        source.setDivorceCertificates(divorceCertificates);
+        source.setPersonImages(personImages);
+        source.setPersonTexts(personTexts);
+        source.setCensusEntries(censusEntries);
+        source.setDeathCertificates(deathCertificates);
+        source.setBirthCertificates(birthCertificates);
+        source.setMarriageCertificates(marriageCertificates);
+
+
         Person target = converter.convert(source);
 
         assert target != null;
@@ -46,5 +86,14 @@ class PersonCommandConverterTest {
         assertEquals(lastName, target.getLastName());
         assertEquals(recordedYearOfBirth, target.getRecordedYearOfBirth());
         assertEquals(certifiedYearOfBirth, target.getCertifiedYearOfBirth());
+
+        assertEquals(divorceCertificates, target.getDivorceCertificates());
+        assertEquals(personImages, target.getPersonImages());
+        assertEquals(personTexts, target.getPersonTexts());
+        assertEquals(censusEntries, target.getCensusEntries());
+        assertEquals(deathCertificates, target.getDeathCertificates());
+        assertEquals(birthCertificates, target.getBirthCertificates());
+        assertEquals(marriageCertificates, target.getMarriageCertificates());
+
     }
 }

+ 49 - 0
src/test/java/scot/carricksoftware/grants/converters/people/PersonConverterTest.java

@@ -8,7 +8,16 @@ package scot.carricksoftware.grants.converters.people;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import scot.carricksoftware.grants.commands.people.PersonCommand;
+import scot.carricksoftware.grants.domains.census.CensusEntry;
+import scot.carricksoftware.grants.domains.certificates.BirthCertificate;
+import scot.carricksoftware.grants.domains.certificates.DeathCertificate;
+import scot.carricksoftware.grants.domains.certificates.DivorceCertificate;
+import scot.carricksoftware.grants.domains.certificates.MarriageCertificate;
+import scot.carricksoftware.grants.domains.images.PersonImage;
 import scot.carricksoftware.grants.domains.people.Person;
+import scot.carricksoftware.grants.domains.text.PersonText;
+
+import java.util.ArrayList;
 
 import static org.junit.jupiter.api.Assertions.*;
 import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
@@ -33,12 +42,43 @@ class PersonConverterTest {
         String recordedYearOfBirth = GetRandomString();
         String certifiedYearOfBirth = GetRandomString();
 
+        ArrayList<DivorceCertificate> divorceCertificates = new ArrayList<>();
+        divorceCertificates.add(new DivorceCertificate());
+
+        ArrayList<PersonImage> personImages = new ArrayList<>();
+        personImages.add(new PersonImage());
+
+        ArrayList<PersonText> personTexts = new ArrayList<>();
+        personTexts.add(new PersonText());
+
+        ArrayList<CensusEntry> censusEntries = new ArrayList<>();
+        censusEntries.add(new CensusEntry());
+
+        ArrayList<DeathCertificate> deathCertificates = new ArrayList<>();
+        deathCertificates.add(new DeathCertificate());
+
+        ArrayList<BirthCertificate> birthCertificates = new ArrayList<>();
+        birthCertificates.add(new BirthCertificate());
+
+        ArrayList<MarriageCertificate> marriageCertificates = new ArrayList<>();
+        marriageCertificates.add(new MarriageCertificate());
+
+
         source.setId(id);
         source.setFirstName(firstName);
         source.setLastName(lastName);
         source.setRecordedYearOfBirth(recordedYearOfBirth);
         source.setCertifiedYearOfBirth(certifiedYearOfBirth);
 
+        source.setDivorceCertificates(divorceCertificates);
+        source.setPersonImages(personImages);
+        source.setPersonTexts(personTexts);
+        source.setCensusEntries(censusEntries);
+        source.setDeathCertificates(deathCertificates);
+        source.setBirthCertificates(birthCertificates);
+        source.setMarriageCertificates(marriageCertificates);
+
+
         PersonCommand target = converter.convert(source);
 
         assert target != null;
@@ -47,5 +87,14 @@ class PersonConverterTest {
         assertEquals(lastName, target.getLastName());
         assertEquals(recordedYearOfBirth, target.getRecordedYearOfBirth());
         assertEquals(certifiedYearOfBirth, target.getCertifiedYearOfBirth());
+
+        assertEquals(divorceCertificates, target.getDivorceCertificates());
+        assertEquals(personImages, target.getPersonImages());
+        assertEquals(personTexts, target.getPersonTexts());
+        assertEquals(censusEntries, target.getCensusEntries());
+        assertEquals(deathCertificates, target.getDeathCertificates());
+        assertEquals(birthCertificates, target.getBirthCertificates());
+        assertEquals(marriageCertificates, target.getMarriageCertificates());
+
     }
 }