Bläddra i källkod

Divorce certificate converter test

Andrew Grant 3 månader sedan
förälder
incheckning
a1f58c2ef9

+ 4 - 3
src/main/java/scot/carricksoftware/grants/converters/certificates/divorcecertificates/DivorceCertificateConverterImpl.java

@@ -19,13 +19,14 @@ public class DivorceCertificateConverterImpl implements DivorceCertificateConver
     public DivorceCertificateCommand convert(DivorceCertificate source) {
         DivorceCertificateCommand target = new DivorceCertificateCommandImpl();
 
+        target.setFirstPartyDate(source.getFirstPartyDate());
+        target.setSecondPartyDate(source.getSecondPartyDate());
+        target.setRegisteredDate(source.getRegisteredDate());
         target.setId(source.getId());
         target.setFirstParty(source.getFirstParty());
         target.setSecondParty(source.getSecondParty());
 
-        target.setFirstPartyDate(source.getFirstPartyDate());
-        target.setSecondPartyDate(source.getSecondPartyDate());
-        target.setRegisteredDate(source.getRegisteredDate());
+
 
         return target;
     }

+ 10 - 0
src/test/java/scot/carricksoftware/grants/converters/certificates/divorcecertificates/DivorceCertificateCommandConverterTest.java

@@ -14,6 +14,7 @@ import scot.carricksoftware.grants.domains.certificates.DivorceCertificate;
 import scot.carricksoftware.grants.domains.people.Person;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
 import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
 
@@ -31,11 +32,17 @@ class DivorceCertificateCommandConverterTest {
         Long id = GetRandomLong();
         Person firstParty = GetRandomPerson();
         Person secondParty = GetRandomPerson();
+        String firstPartyDate = GetRandomString();
+        String secondPartyDate = GetRandomString();
+        String registeredDate = GetRandomString();
         DivorceCertificateCommand source = new DivorceCertificateCommandImpl();
 
         source.setId(id);
         source.setFirstParty(firstParty);
         source.setSecondParty(secondParty);
+        source.setFirstPartyDate(firstPartyDate);
+        source.setSecondPartyDate(secondPartyDate);
+        source.setRegisteredDate(registeredDate);
 
         DivorceCertificate target = converter.convert(source);
 
@@ -43,5 +50,8 @@ class DivorceCertificateCommandConverterTest {
         assertEquals(id, target.getId());
         assertEquals(firstParty, target.getFirstParty());
         assertEquals(secondParty, target.getSecondParty());
+        assertEquals(firstPartyDate, target.getFirstPartyDate());
+        assertEquals(secondPartyDate, target.getSecondPartyDate());
+        assertEquals(registeredDate, target.getRegisteredDate());
     }
 }

+ 10 - 0
src/test/java/scot/carricksoftware/grants/converters/certificates/divorcecertificates/DivorceCertificateConverterTest.java

@@ -13,6 +13,7 @@ import scot.carricksoftware.grants.domains.certificates.DivorceCertificate;
 import scot.carricksoftware.grants.domains.people.Person;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
 import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
 
@@ -30,11 +31,17 @@ class DivorceCertificateConverterTest {
         Long id = GetRandomLong();
         Person firstParty = GetRandomPerson();
         Person secondParty = GetRandomPerson();
+        String firstPartyDate = GetRandomString();
+        String secondPartyDate = GetRandomString();
+        String registeredDate = GetRandomString();
         DivorceCertificate source = new DivorceCertificate();
 
         source.setId(id);
         source.setFirstParty(firstParty);
         source.setSecondParty(secondParty);
+        source.setFirstPartyDate(firstPartyDate);
+        source.setSecondPartyDate(secondPartyDate);
+        source.setRegisteredDate(registeredDate);
 
         DivorceCertificateCommand target = converter.convert(source);
 
@@ -42,5 +49,8 @@ class DivorceCertificateConverterTest {
         assertEquals(id, target.getId());
         assertEquals(firstParty, target.getFirstParty());
         assertEquals(secondParty, target.getSecondParty());
+        assertEquals(firstPartyDate, target.getFirstPartyDate());
+        assertEquals(secondPartyDate, target.getSecondPartyDate());
+        assertEquals(registeredDate, target.getRegisteredDate());
     }
 }