Browse Source

BaseCertificateTest

Andrew Grant 4 months ago
parent
commit
1d17ab3da9

+ 34 - 33
src/main/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/DeathCertificateCommandConverterImpl.java

@@ -17,41 +17,42 @@ public class DeathCertificateCommandConverterImpl implements DeathCertificateCom
     public DeathCertificate convert(DeathCertificateCommand source) {
 
         DeathCertificate target = new DeathCertificate();
-
-        target.setId(source.getId());target.setCertificateNumber(source.getCertificateNumber());
-        target.setCertificateDate(source.getCertificateDate());
-        target.setCertificateSource(source.getCertificateSource());
-        target.setCertificateType(source.getCertificateType());
-        target.setRegistrationAuthority(source.getRegistrationAuthority());
-        target.setVolume(source.getVolume());
-        target.setNumber(source.getNumber());
-        target.setDeceased(source.getDeceased());
-        target.setFather(source.getFather());
-        target.setInformant(source.getInformant());
-        target.setMother(source.getMother());
-        target.setSpouse(source.getSpouse());
-        target.setUsualResidence(source.getUsualResidence());
-        target.setWhereDied(source.getWhereDied());
-        target.setSex(source.getSex());
         target.setAge(source.getAge());
-        target.setCauseOfDeath(source.getCauseOfDeath());
-        target.setFatherOccupation(source.getFatherOccupation());
-        target.setInformantAddress(source.getInformantAddress());
-        target.setInformantQualification(source.getInformantQualification());
-        target.setMaritalStatus(source.getMaritalStatus());
-        target.setMotherOccupation(source.getMotherOccupation());
-        target.setOccupation(source.getOccupation());
-        target.setSpouseOccupation(source.getSpouseOccupation());
-        target.setUntrackedFather(source.getUntrackedFather());
-        target.setUntrackedInformant(source.getUntrackedInformant());
-        target.setUntrackedMother(source.getUntrackedMother());
-        target.setUntrackedSpouse(source.getUntrackedSpouse());
-        target.setUntrackedUsualResidence(source.getUntrackedUsualResidence());
-        target.setUntrackedWhereDied(source.getUntrackedWhereDied());
-        target.setWhenBorn(source.getWhenBorn());
-        target.setWhenDied(source.getWhenDied());
-        target.setWhenRegistered(source.getWhenRegistered());
+        target.setSex(source.getSex());
+        target.setWhereDied(source.getWhereDied());
+        target.setUsualResidence(source.getUsualResidence());
+        target.setSpouse(source.getSpouse());
+        target.setMother(source.getMother());
+        target.setInformant(source.getInformant());
+        target.setFather(source.getFather());
+        target.setDeceased(source.getDeceased());
+        target.setNumber(source.getNumber());
+        target.setVolume(source.getVolume());
+        target.setRegistrationAuthority(source.getRegistrationAuthority());
+        target.setCertificateType(source.getCertificateType());
+        target.setCertificateSource(source.getCertificateSource());
+        target.setCertificateDate(source.getCertificateDate());
+        target.setId(source.getId());target.setCertificateNumber(source.getCertificateNumber());
         target.setWhereRegistered(source.getWhereRegistered());
+        target.setWhenRegistered(source.getWhenRegistered());
+        target.setWhenDied(source.getWhenDied());
+        target.setWhenBorn(source.getWhenBorn());
+        target.setUntrackedWhereDied(source.getUntrackedWhereDied());
+        target.setUntrackedUsualResidence(source.getUntrackedUsualResidence());
+        target.setUntrackedSpouse(source.getUntrackedSpouse());
+        target.setUntrackedMother(source.getUntrackedMother());
+        target.setUntrackedInformant(source.getUntrackedInformant());
+        target.setUntrackedFather(source.getUntrackedFather());
+        target.setSpouseOccupation(source.getSpouseOccupation());
+        target.setOccupation(source.getOccupation());
+        target.setMotherOccupation(source.getMotherOccupation());
+        target.setMaritalStatus(source.getMaritalStatus());
+        target.setInformantQualification(source.getInformantQualification());
+        target.setInformantAddress(source.getInformantAddress());
+        target.setFatherOccupation(source.getFatherOccupation());
+        target.setCauseOfDeath(source.getCauseOfDeath());
+
+
 
         return target;
     }

+ 13 - 13
src/main/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/DeathCertificateConverterImpl.java

@@ -19,30 +19,27 @@ public class DeathCertificateConverterImpl implements DeathCertificateConverter
     public DeathCertificateCommand convert(DeathCertificate source) {
         DeathCertificateCommand target = new DeathCertificateCommandImpl();
 
-        target.setId(source.getId());
-        target.setCertificateNumber(source.getCertificateNumber());
+        target.setAge(source.getAge());
+        target.setCauseOfDeath(source.getCauseOfDeath());
         target.setCertificateDate(source.getCertificateDate());
+        target.setCertificateNumber(source.getCertificateNumber());
         target.setCertificateSource(source.getCertificateSource());
         target.setCertificateType(source.getCertificateType());
-        target.setRegistrationAuthority(source.getRegistrationAuthority());
-        target.setVolume(source.getVolume());
-        target.setNumber(source.getNumber());
         target.setDeceased(source.getDeceased());
         target.setFather(source.getFather());
-        target.setInformant(source.getInformant());
-        target.setMother(source.getMother());
-        target.setSpouse(source.getSpouse());
-        target.setUsualResidence(source.getUsualResidence());
-        target.setWhereDied(source.getWhereDied());
-        target.setSex(source.getSex());
-        target.setAge(source.getAge());
-        target.setCauseOfDeath(source.getCauseOfDeath());
         target.setFatherOccupation(source.getFatherOccupation());
+        target.setId(source.getId());
+        target.setInformant(source.getInformant());
         target.setInformantAddress(source.getInformantAddress());
         target.setInformantQualification(source.getInformantQualification());
         target.setMaritalStatus(source.getMaritalStatus());
+        target.setMother(source.getMother());
         target.setMotherOccupation(source.getMotherOccupation());
+        target.setNumber(source.getNumber());
         target.setOccupation(source.getOccupation());
+        target.setRegistrationAuthority(source.getRegistrationAuthority());
+        target.setSex(source.getSex());
+        target.setSpouse(source.getSpouse());
         target.setSpouseOccupation(source.getSpouseOccupation());
         target.setUntrackedFather(source.getUntrackedFather());
         target.setUntrackedInformant(source.getUntrackedInformant());
@@ -50,9 +47,12 @@ public class DeathCertificateConverterImpl implements DeathCertificateConverter
         target.setUntrackedSpouse(source.getUntrackedSpouse());
         target.setUntrackedUsualResidence(source.getUntrackedUsualResidence());
         target.setUntrackedWhereDied(source.getUntrackedWhereDied());
+        target.setUsualResidence(source.getUsualResidence());
+        target.setVolume(source.getVolume());
         target.setWhenBorn(source.getWhenBorn());
         target.setWhenDied(source.getWhenDied());
         target.setWhenRegistered(source.getWhenRegistered());
+        target.setWhereDied(source.getWhereDied());
         target.setWhereRegistered(source.getWhereRegistered());
 
         return target;

+ 0 - 43
src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/command/DeathCertificateConverterLongTest.java

@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
- *
- */
-
-package scot.carricksoftware.grants.converters.certificates.deathcertificates.command;
-
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommand;
-import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateConverter;
-import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateConverterImpl;
-import scot.carricksoftware.grants.domains.certificates.DeathCertificate;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
-
-class DeathCertificateConverterLongTest {
-
-    private DeathCertificateConverter converter;
-
-    @BeforeEach
-    void setUp() {
-        converter = new DeathCertificateConverterImpl();
-    }
-
-    @Test
-    void convertTest() {
-        Long id = GetRandomLong();
-
-        DeathCertificate source = new DeathCertificate();
-
-        source.setId(id);
-
-        DeathCertificateCommand target = converter.convert(source);
-
-        assert target != null;
-        assertEquals(id,target.getId());
-
-
-    }
-}

+ 34 - 0
src/test/java/scot/carricksoftware/grants/domains/certificates/BaseCertificateTest.java

@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grants.domains.certificates;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
+
+class BaseCertificateTest {
+
+    private BaseCertificate baseCertificate;
+
+    @BeforeEach
+    void setUp() {
+        baseCertificate = new BaseCertificate();
+    }
+
+    @Test
+    void getCertificateNumberTest() {
+        assertNull(baseCertificate.getCertificateNumber());
+    }
+
+    @Test
+    void setCertificateNumberTest() {
+        String certificateNumber = GetRandomString();
+        baseCertificate.setCertificateNumber(certificateNumber);
+        assertEquals(certificateNumber, baseCertificate.getCertificateNumber());
+    }
+}

+ 0 - 54
src/test/java/scot/carricksoftware/grants/domains/certificates/death/DeathCertificateOrganisationTest.java

@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
- *
- */
-
-package scot.carricksoftware.grants.domains.certificates.death;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import scot.carricksoftware.grants.domains.certificates.DeathCertificate;
-import scot.carricksoftware.grants.domains.places.Organisation;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomOrganisation;
-
-
-class DeathCertificateOrganisationTest {
-
-    private DeathCertificate deathCertificate;
-
-    @BeforeEach
-    void setUp() {
-        deathCertificate = new DeathCertificate();
-    }
-
-    @Test
-    void getCertificateSourceTest() {
-        assertNull(deathCertificate.getCertificateSource());
-    }
-
-    @Test
-    void setCertificateSourceTest() {
-        Organisation certificateSource = GetRandomOrganisation();
-        deathCertificate.setCertificateSource(certificateSource);
-        assertEquals(certificateSource, deathCertificate.getCertificateSource());
-    }
-
-    @Test
-    void getRegistrationAuthorityTest() {
-        assertNull(deathCertificate.getRegistrationAuthority());
-    }
-
-    @Test
-    void setRegistrationAuthorityTest() {
-        Organisation registrationAuthority = GetRandomOrganisation();
-        deathCertificate.setRegistrationAuthority(registrationAuthority);
-        assertEquals(registrationAuthority, deathCertificate.getRegistrationAuthority());
-    }
-
-
-
-
-}

+ 0 - 62
src/test/java/scot/carricksoftware/grants/domains/certificates/death/DeathCertificateStringTest.java

@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
- *
- */
-
-package scot.carricksoftware.grants.domains.certificates.death;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import scot.carricksoftware.grants.domains.certificates.DeathCertificate;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
-
-
-class DeathCertificateStringTest {
-
-    private DeathCertificate deathCertificate;
-
-    @BeforeEach
-    void setUp() {
-        deathCertificate = new DeathCertificate();
-    }
-
-    @Test
-    void getNumberTest() {
-        assertEquals(null,deathCertificate.getNumber());
-    }
-
-    @Test
-    void setNumberTest() {
-        String number = GetRandomString();
-        deathCertificate.setNumber(number);
-        assertEquals(number, deathCertificate.getNumber());
-    }
-
-    @Test
-    void getVolumeTest() {
-        assertNull(deathCertificate.getVolume());
-    }
-
-    @Test
-    void setVolumeTest() {
-        String volume = GetRandomString();
-        deathCertificate.setVolume(volume);
-        assertEquals(volume, deathCertificate.getVolume());
-    }
-
-    @Test
-    void getCertificateNumberTest() {
-        assertNull(deathCertificate.getCertificateNumber());
-    }
-
-    @Test
-    void setCertificateNumberTest() {
-        String certificateNumber = GetRandomString();
-        deathCertificate.setCertificateNumber(certificateNumber);
-        assertEquals(certificateNumber, deathCertificate.getCertificateNumber());
-    }
-
-}

+ 0 - 10
src/test/java/scot/carricksoftware/grants/domains/certificates/death/DeathCertificateTimeTest.java

@@ -72,16 +72,6 @@ class DeathCertificateTimeTest {
         assertEquals(whenRegistered, deathCertificate.getWhenRegistered());
     }
 
-    @Test
-    void getCertificateDateTest() {
-        assertNull(deathCertificate.getCertificateDate());
-    }
 
-    @Test
-    void setCertificateDateTest() {
-        String certificateDate = GetRandomString();
-        deathCertificate.setCertificateDate(certificateDate);
-        assertEquals(certificateDate, deathCertificate.getCertificateDate());
-    }
 
 }

+ 0 - 10
src/test/java/scot/carricksoftware/grants/domains/certificates/death/DeathCertificateTwoTest.java

@@ -47,16 +47,6 @@ class DeathCertificateTwoTest {
         assertEquals(informantQualification, deathCertificate.getInformantQualification());
     }
 
-    @Test
-    void getCertificateNumberTest() {
-        assertNull(deathCertificate.getCertificateNumber());
-    }
 
-    @Test
-    void setCertificateNumberTest() {
-        String certificateNumber = GetRandomString();
-        deathCertificate.setCertificateNumber(certificateNumber);
-        assertEquals(certificateNumber, deathCertificate.getCertificateNumber());
-    }
 
 }