Browse Source

Birth Certificate family in bootstrap

Andrew Grant 6 months ago
parent
commit
25a0cd3340

+ 1 - 1
docs/additions.txt

@@ -6,7 +6,7 @@
 5: Command getter and setter in Command Test
 6: Converter
 7: Converter Test
-8: Bootstrap (use personal details)
+8: Bootstrap
 9: Bootstrap Test
 10: Modify the form
 10.1: Uppercase on save

+ 17 - 3
src/main/java/scot/carricksoftware/grants/bootstrap/DataLoadCertificates.java

@@ -12,6 +12,7 @@ import org.springframework.stereotype.Component;
 import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommand;
 import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommandImpl;
 import scot.carricksoftware.grants.domains.certificates.DeathCertificate;
+import scot.carricksoftware.grants.domains.people.Person;
 import scot.carricksoftware.grants.domains.places.Organisation;
 import scot.carricksoftware.grants.enums.general.Sex;
 import scot.carricksoftware.grants.enums.certificates.CertificateType;
@@ -48,9 +49,13 @@ public class DataLoadCertificates {
         loadDeathCertificates();
     }
 
+
+
     private void loadBirthCertificates() {
         BirthCertificateCommand birthCertificateCommand = new BirthCertificateCommandImpl();
-        birthCertificateCommand.setNewBorn(personService.findById(1L));
+        Person newBorn = new Person();
+        newBorn.setFirstName("new born");
+        birthCertificateCommand.setNewBorn(newBorn);
         birthCertificateCommand.setCertificateDate("25/01/1953");
         birthCertificateCommand.setCertificateNumber("999");
         birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
@@ -62,10 +67,19 @@ public class DataLoadCertificates {
         birthCertificateCommand.setVolume("1953");
         birthCertificateCommand.setSex(Sex.MALE);
         birthCertificateCommand.setWhenBorn("25/01/1953 01:01");
-        birthCertificateCommand.setWhereBorn("Edinburgh");
+        birthCertificateCommand.setWhereBorn("where born");
+        birthCertificateCommand.setDateAndPlaceOfMarriage("dateAndPlaceOfMarriage");
+        birthCertificateCommand.setFatherRank("fatherRank");
 
-        birthCertificateService.saveBirthCertificateCommand(birthCertificateCommand);
+        Person father = new Person();
+        father.setFirstName("father");
+        birthCertificateCommand.setFather(father);
+        birthCertificateCommand.setUntrackedFather("untrackedFather");
+        Person mother = new Person();
+        mother.setFirstName("mother");
+        birthCertificateCommand.setMother(mother);
 
+        birthCertificateService.saveBirthCertificateCommand(birthCertificateCommand);
     }
 
     private void loadDeathCertificates() {

+ 7 - 2
src/test/java/scot/carricksoftware/grants/bootstrap/DataLoadCertificatesTest.java

@@ -61,7 +61,7 @@ public class DataLoadCertificatesTest {
         dataLoadCertificates.load();
 
         verify(birthCertificateServiceMock).saveBirthCertificateCommand(captor.capture());
-        assertEquals(person, captor.getValue().getNewBorn());
+        assertEquals("new born", captor.getValue().getNewBorn().getFirstName());
         assertEquals(organisation, captor.getValue().getCertificateSource());
         assertEquals("999", captor.getValue().getCertificateNumber());
         assertEquals("25/01/1953", captor.getValue().getCertificateDate());
@@ -71,7 +71,12 @@ public class DataLoadCertificatesTest {
         assertEquals("1953", captor.getValue().getVolume());
         assertEquals(Sex.MALE, captor.getValue().getSex());
         assertEquals("25/01/1953 01:01", captor.getValue().getWhenBorn());
-        assertEquals("Edinburgh", captor.getValue().getWhereBorn());
+        assertEquals("where born", captor.getValue().getWhereBorn());
+        assertEquals("fatherRank", captor.getValue().getFatherRank());
+        assertEquals("untrackedFather", captor.getValue().getUntrackedFather());
+        assertEquals("father", captor.getValue().getFather().getFirstName());
+        assertEquals("mother", captor.getValue().getMother().getFirstName());
+
     }
 
     @Test