Переглянути джерело

Birth Certificate extra fields in converters

Andrew Grant 6 місяців тому
батько
коміт
cae7abccb7

+ 3 - 0
src/main/java/scot/carricksoftware/grants/converters/certificates/birthcertificates/BirthCertificateCommandConverterImpl.java

@@ -26,6 +26,9 @@ public class BirthCertificateCommandConverterImpl implements BirthCertificateCom
         target.setRegistrationAuthority(source.getRegistrationAuthority());
         target.setVolume(source.getVolume());
         target.setNumber(source.getNumber());
+        target.setSex(source.getSex());
+        target.setWhenBorn(source.getWhenBorn());
+        target.setWhereBorn(source.getWhereBorn());
 
         return target;
     }

+ 3 - 0
src/main/java/scot/carricksoftware/grants/converters/certificates/birthcertificates/BirthCertificateConverterImpl.java

@@ -30,6 +30,9 @@ public class BirthCertificateConverterImpl implements BirthCertificateConverter
         target.setRegistrationAuthority(source.getRegistrationAuthority());
         target.setVolume(source.getVolume());
         target.setNumber(source.getNumber());
+        target.setSex(source.getSex());
+        target.setWhenBorn(source.getWhenBorn());
+        target.setWhereBorn(source.getWhereBorn());
 
         return target;
     }

+ 10 - 2
src/test/java/scot/carricksoftware/grants/converters/certificates/birthcertificates/BirthCertificateCommandConverterTest.java

@@ -13,6 +13,7 @@ import scot.carricksoftware.grants.commands.certificates.birthcertificates.Birth
 import scot.carricksoftware.grants.domains.certificates.BirthCertificate;
 import scot.carricksoftware.grants.domains.people.Person;
 import scot.carricksoftware.grants.domains.places.Organisation;
+import scot.carricksoftware.grants.enums.censusentry.CensusEntrySex;
 import scot.carricksoftware.grants.enums.certificates.CertificateType;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -42,7 +43,9 @@ class BirthCertificateCommandConverterTest {
         Organisation registrationAuthority = GetRandomOrganisation();
         String volume = GetRandomString();
         String number = GetRandomString();
-
+        CensusEntrySex sex = CensusEntrySex.MALE;
+        String whenBorn = GetRandomString();
+        String whereBorn = GetRandomString();
 
         source.setId(id);
         source.setNewBorn(person);
@@ -53,6 +56,9 @@ class BirthCertificateCommandConverterTest {
         source.setVolume(volume);
         source.setNumber(number);
         source.setRegistrationAuthority(registrationAuthority);
+        source.setSex(sex);
+        source.setWhenBorn(whenBorn);
+        source.setWhereBorn(whereBorn);
 
 
         BirthCertificate target = converter.convert(source);
@@ -67,6 +73,8 @@ class BirthCertificateCommandConverterTest {
         assertEquals(volume, target.getVolume());
         assertEquals(number, target.getNumber());
         assertEquals(registrationAuthority, target.getRegistrationAuthority());
-
+        assertEquals(sex, target.getSex());
+        assertEquals(whereBorn, target.getWhereBorn());
+        assertEquals(whenBorn, target.getWhenBorn());
     }
 }

+ 10 - 0
src/test/java/scot/carricksoftware/grants/converters/certificates/birthcertificates/BirthCertificateConverterTest.java

@@ -12,6 +12,7 @@ import scot.carricksoftware.grants.commands.certificates.birthcertificates.Birth
 import scot.carricksoftware.grants.domains.certificates.BirthCertificate;
 import scot.carricksoftware.grants.domains.people.Person;
 import scot.carricksoftware.grants.domains.places.Organisation;
+import scot.carricksoftware.grants.enums.censusentry.CensusEntrySex;
 import scot.carricksoftware.grants.enums.certificates.CertificateType;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -41,6 +42,9 @@ class BirthCertificateConverterTest {
         Organisation registrationAuthority = GetRandomOrganisation();
         String volume = GetRandomString();
         String number = GetRandomString();
+        CensusEntrySex sex = CensusEntrySex.MALE;
+        String whenBorn = GetRandomString();
+        String whereBorn = GetRandomString();
 
         source.setId(id);
         source.setNewBorn(person);
@@ -51,6 +55,9 @@ class BirthCertificateConverterTest {
         source.setVolume(volume);
         source.setNumber(number);
         source.setRegistrationAuthority(registrationAuthority);
+        source.setSex(sex);
+        source.setWhenBorn(whenBorn);
+        source.setWhereBorn(whereBorn);
 
 
         BirthCertificateCommand target = converter.convert(source);
@@ -65,6 +72,9 @@ class BirthCertificateConverterTest {
         assertEquals(volume, target.getVolume());
         assertEquals(number, target.getNumber());
         assertEquals(registrationAuthority, target.getRegistrationAuthority());
+        assertEquals(sex, target.getSex());
+        assertEquals(whereBorn, target.getWhereBorn());
+        assertEquals(whenBorn, target.getWhenBorn());
 
     }
 }