ソースを参照

DeathCertificateCommand Converters Test

Andrew Grant 4 ヶ月 前
コミット
59a90c5c96
10 ファイル変更276 行追加19 行削除
  1. 9 9
      src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/command/DeathCertificateConverterLongTest.java
  2. 58 0
      src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/command/DeathCertificateConverterPersonTest.java
  3. 47 0
      src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/command/DeathCertificateConverterPlaceTest.java
  4. 45 0
      src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/command/DeathCertificateConverterSexTest.java
  5. 97 0
      src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/command/DeathCertificateConverterStringTest.java
  6. 4 2
      src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/domain/DeathCertificateCommandConverterLongTest.java
  7. 4 2
      src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/domain/DeathCertificateCommandConverterPersonTest.java
  8. 4 2
      src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/domain/DeathCertificateCommandConverterPlaceTest.java
  9. 4 2
      src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/domain/DeathCertificateCommandConverterSexTest.java
  10. 4 2
      src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/domain/DeathCertificateCommandConverterStringTest.java

+ 9 - 9
src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/DeathCertificateConverterTest.java → src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/command/DeathCertificateConverterLongTest.java

@@ -1,22 +1,22 @@
 /*
- * Copyright (c) Andrew Grant of Carrick Software 24/03/2025, 19:02. All rights reserved.
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
  *
  */
 
-package scot.carricksoftware.grants.converters.certificates.deathcertificates;
+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 scot.carricksoftware.grants.domains.people.Person;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
-import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
 
-class DeathCertificateConverterTest {
+class DeathCertificateConverterLongTest {
 
     private DeathCertificateConverter converter;
 
@@ -28,16 +28,16 @@ class DeathCertificateConverterTest {
     @Test
     void convertTest() {
         Long id = GetRandomLong();
-        Person person = GetRandomPerson();
+
         DeathCertificate source = new DeathCertificate();
 
         source.setId(id);
-        source.setDeceased(person);
 
         DeathCertificateCommand target = converter.convert(source);
 
         assert target != null;
-        assertEquals(id, target.getId());
-        assertEquals(person, target.getDeceased());
+        assertEquals(id,target.getId());
+
+
     }
 }

+ 58 - 0
src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/command/DeathCertificateConverterPersonTest.java

@@ -0,0 +1,58 @@
+/*
+ * 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 scot.carricksoftware.grants.domains.people.Person;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
+import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
+
+class DeathCertificateConverterPersonTest {
+
+    private DeathCertificateConverter converter;
+
+    @BeforeEach
+    void setUp() {
+        converter = new DeathCertificateConverterImpl();
+    }
+
+    @Test
+    void convertTest() {
+        Long id = GetRandomLong();
+        Person person = GetRandomPerson();
+        Person father = GetRandomPerson();
+        Person informant = GetRandomPerson();
+        Person mother = GetRandomPerson();
+        Person spouse = GetRandomPerson();
+
+        DeathCertificate source = new DeathCertificate();
+
+        source.setId(id);
+        source.setDeceased(person);
+        source.setFather(father);
+        source.setInformant(informant);
+        source.setMother(mother);
+        source.setSpouse(spouse);
+
+        DeathCertificateCommand target = converter.convert(source);
+
+        assert target != null;
+        assertEquals(id,target.getId());
+        assertEquals(person,target.getDeceased());
+        assertEquals(father,target.getFather());
+        assertEquals(informant,target.getInformant());
+        assertEquals(mother,target.getMother());
+        assertEquals(spouse,target.getSpouse());
+    }
+}

+ 47 - 0
src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/command/DeathCertificateConverterPlaceTest.java

@@ -0,0 +1,47 @@
+/*
+ * 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 scot.carricksoftware.grants.domains.places.Place;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomPlace;
+
+class DeathCertificateConverterPlaceTest {
+
+    private DeathCertificateConverter converter;
+
+    @BeforeEach
+    void setUp() {
+        converter = new DeathCertificateConverterImpl();
+    }
+
+    @Test
+    void convertTest() {
+        Place usualResidence = GetRandomPlace();
+        Place whereDied = GetRandomPlace();
+
+        DeathCertificate source = new DeathCertificate();
+
+        source.setUsualResidence(usualResidence);
+        source.setWhereDied(whereDied);
+
+        DeathCertificateCommand target = converter.convert(source);
+
+        assert target != null;
+
+        assertEquals(usualResidence,target.getUsualResidence());
+        assertEquals(whereDied,target.getWhereDied());
+
+    }
+}

+ 45 - 0
src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/command/DeathCertificateConverterSexTest.java

@@ -0,0 +1,45 @@
+/*
+ * 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 scot.carricksoftware.grants.enums.general.Sex;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class DeathCertificateConverterSexTest {
+
+    private DeathCertificateConverter converter;
+
+    @BeforeEach
+    void setUp() {
+        converter = new DeathCertificateConverterImpl();
+    }
+
+    @Test
+    void convertTest() {
+
+        Sex sex = Sex.MALE;
+
+        DeathCertificate source = new DeathCertificate();
+
+        source.setSex(sex);
+
+        DeathCertificateCommand target = converter.convert(source);
+
+        assert target != null;
+
+        assertEquals(sex,target.getSex());
+
+        
+    }
+}

+ 97 - 0
src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/command/DeathCertificateConverterStringTest.java

@@ -0,0 +1,97 @@
+/*
+ * 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.GenerateCertificateRandomValues.GetRandomString;
+
+class DeathCertificateConverterStringTest {
+
+    private DeathCertificateConverter converter;
+
+    @BeforeEach
+    void setUp() {
+        converter = new DeathCertificateConverterImpl();
+    }
+
+    @Test
+    void convertTest() {
+        String age = GetRandomString();
+        String causeOfDeath = GetRandomString();
+        String fatherOccupation = GetRandomString();
+        String informantAddress = GetRandomString();
+        String informantQualification = GetRandomString();
+        String maritalStatus = GetRandomString();
+        String motherOccupation = GetRandomString();
+        String occupation  = GetRandomString();
+        String spouseOccupation = GetRandomString();
+        String untrackedFather = GetRandomString();
+        String untrackedInformant = GetRandomString();
+        String untrackedMother = GetRandomString();
+        String untrackedSpouse = GetRandomString();
+        String untrackedUsualResidence = GetRandomString();
+        String untrackedWhereDied = GetRandomString();
+        String whenBorn = GetRandomString();
+        String whenDied = GetRandomString();
+        String whenRegistered = GetRandomString();
+        String whereRegistered = GetRandomString();
+        
+        DeathCertificate source = new DeathCertificate();
+
+        source.setAge(age);
+        source.setCauseOfDeath(causeOfDeath);
+        source.setFatherOccupation(fatherOccupation);
+        source.setInformantAddress(informantAddress);
+        source.setInformantQualification(informantQualification);
+        source.setMaritalStatus(maritalStatus);
+        source.setMotherOccupation(motherOccupation);
+        source.setOccupation(occupation);
+        source.setSpouseOccupation(spouseOccupation);
+        source.setUntrackedFather(untrackedFather);
+        source.setUntrackedInformant(untrackedInformant);
+        source.setUntrackedMother(untrackedMother);
+        source.setUntrackedSpouse(untrackedSpouse);
+        source.setUntrackedUsualResidence(untrackedUsualResidence);
+        source.setUntrackedWhereDied(untrackedWhereDied);
+        source.setWhenBorn(whenBorn);
+        source.setWhenDied(whenDied);
+        source.setWhenRegistered(whenRegistered);
+        source.setWhereRegistered(whereRegistered);
+        
+        DeathCertificateCommand target = converter.convert(source);
+
+        assert target != null;
+
+        assertEquals(age,target.getAge());
+        assertEquals(causeOfDeath,target.getCauseOfDeath());
+        assertEquals(fatherOccupation,target.getFatherOccupation());
+        assertEquals(informantAddress,target.getInformantAddress());
+        assertEquals(informantQualification,target.getInformantQualification());
+        assertEquals(maritalStatus,target.getMaritalStatus());
+        assertEquals(motherOccupation,target.getMotherOccupation());
+        assertEquals(occupation,target.getOccupation());
+        assertEquals(spouseOccupation,target.getSpouseOccupation());
+        assertEquals(untrackedFather,target.getUntrackedFather());
+        assertEquals(untrackedInformant,target.getUntrackedInformant());
+        assertEquals(untrackedMother,target.getUntrackedMother());
+        assertEquals(untrackedSpouse,target.getUntrackedSpouse());
+        assertEquals(untrackedUsualResidence,target.getUntrackedUsualResidence());
+        assertEquals(untrackedWhereDied,target.getUntrackedWhereDied());
+        assertEquals(whenBorn,target.getWhenBorn());
+        assertEquals(whenDied,target.getWhenDied());
+        assertEquals(whenRegistered,target.getWhenRegistered());
+        assertEquals(whereRegistered,target.getWhereRegistered());
+        
+    }
+}

+ 4 - 2
src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/DeathCertificateCommandConverterLongTest.java → src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/domain/DeathCertificateCommandConverterLongTest.java

@@ -1,15 +1,17 @@
 /*
- * Copyright (c) Andrew Grant of Carrick Software 24/03/2025, 19:02. All rights reserved.
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
  *
  */
 
-package scot.carricksoftware.grants.converters.certificates.deathcertificates;
+package scot.carricksoftware.grants.converters.certificates.deathcertificates.domain;
 
 
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommand;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommandImpl;
+import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverter;
+import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverterImpl;
 import scot.carricksoftware.grants.domains.certificates.DeathCertificate;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;

+ 4 - 2
src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/DeathCertificateCommandConverterPersonTest.java → src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/domain/DeathCertificateCommandConverterPersonTest.java

@@ -1,15 +1,17 @@
 /*
- * Copyright (c) Andrew Grant of Carrick Software 24/03/2025, 19:02. All rights reserved.
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
  *
  */
 
-package scot.carricksoftware.grants.converters.certificates.deathcertificates;
+package scot.carricksoftware.grants.converters.certificates.deathcertificates.domain;
 
 
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommand;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommandImpl;
+import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverter;
+import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverterImpl;
 import scot.carricksoftware.grants.domains.certificates.DeathCertificate;
 import scot.carricksoftware.grants.domains.people.Person;
 

+ 4 - 2
src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/DeathCertificateCommandConverterPlaceTest.java → src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/domain/DeathCertificateCommandConverterPlaceTest.java

@@ -1,15 +1,17 @@
 /*
- * Copyright (c) Andrew Grant of Carrick Software 24/03/2025, 19:02. All rights reserved.
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
  *
  */
 
-package scot.carricksoftware.grants.converters.certificates.deathcertificates;
+package scot.carricksoftware.grants.converters.certificates.deathcertificates.domain;
 
 
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommand;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommandImpl;
+import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverter;
+import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverterImpl;
 import scot.carricksoftware.grants.domains.certificates.DeathCertificate;
 import scot.carricksoftware.grants.domains.places.Place;
 

+ 4 - 2
src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/DeathCertificateCommandConverterSexTest.java → src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/domain/DeathCertificateCommandConverterSexTest.java

@@ -1,15 +1,17 @@
 /*
- * Copyright (c) Andrew Grant of Carrick Software 24/03/2025, 19:02. All rights reserved.
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
  *
  */
 
-package scot.carricksoftware.grants.converters.certificates.deathcertificates;
+package scot.carricksoftware.grants.converters.certificates.deathcertificates.domain;
 
 
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommand;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommandImpl;
+import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverter;
+import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverterImpl;
 import scot.carricksoftware.grants.domains.certificates.DeathCertificate;
 import scot.carricksoftware.grants.enums.general.Sex;
 

+ 4 - 2
src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/DeathCertificateCommandConverterStringTest.java → src/test/java/scot/carricksoftware/grants/converters/certificates/deathcertificates/domain/DeathCertificateCommandConverterStringTest.java

@@ -1,15 +1,17 @@
 /*
- * Copyright (c) Andrew Grant of Carrick Software 24/03/2025, 19:02. All rights reserved.
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
  *
  */
 
-package scot.carricksoftware.grants.converters.certificates.deathcertificates;
+package scot.carricksoftware.grants.converters.certificates.deathcertificates.domain;
 
 
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommand;
 import scot.carricksoftware.grants.commands.certificates.deathcertificates.DeathCertificateCommandImpl;
+import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverter;
+import scot.carricksoftware.grants.converters.certificates.deathcertificates.DeathCertificateCommandConverterImpl;
 import scot.carricksoftware.grants.domains.certificates.DeathCertificate;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;