Jelajahi Sumber

MarriageCertificateBrideCommandConverterTest

Andrew Grant 4 bulan lalu
induk
melakukan
0751a054a6

+ 1 - 0
src/main/java/scot/carricksoftware/grants/converters/certificates/marriagecertificates/MarriageCertificateCommandConverterImpl.java

@@ -7,6 +7,7 @@ package scot.carricksoftware.grants.converters.certificates.marriagecertificates
 
 import org.springframework.stereotype.Component;
 import scot.carricksoftware.grants.commands.certificates.marriagecertificates.MarriageCertificateCommand;
+import scot.carricksoftware.grants.converters.certificates.marriagecertificates.helpers.MarriageCertificateBrideCommandConverter;
 import scot.carricksoftware.grants.domains.certificates.MarriageCertificate;
 
 @Component

+ 2 - 2
src/main/java/scot/carricksoftware/grants/converters/certificates/marriagecertificates/MarriageCertificateBrideCommandConverter.java → src/main/java/scot/carricksoftware/grants/converters/certificates/marriagecertificates/helpers/MarriageCertificateBrideCommandConverter.java

@@ -1,9 +1,9 @@
 /*
- * Copyright (c) Andrew Grant of Carrick Software 24/03/2025, 17:45. All rights reserved.
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
  *
  */
 
-package scot.carricksoftware.grants.converters.certificates.marriagecertificates;
+package scot.carricksoftware.grants.converters.certificates.marriagecertificates.helpers;
 
 import scot.carricksoftware.grants.commands.certificates.marriagecertificates.MarriageCertificateCommand;
 import scot.carricksoftware.grants.domains.certificates.MarriageCertificate;

+ 2 - 2
src/main/java/scot/carricksoftware/grants/converters/certificates/marriagecertificates/MarriageCertificateBrideCommandConverterImpl.java → src/main/java/scot/carricksoftware/grants/converters/certificates/marriagecertificates/helpers/MarriageCertificateBrideCommandConverterImpl.java

@@ -1,9 +1,9 @@
 /*
- * Copyright (c) Andrew Grant of Carrick Software 24/03/2025, 17:45. All rights reserved.
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
  *
  */
 
-package scot.carricksoftware.grants.converters.certificates.marriagecertificates;
+package scot.carricksoftware.grants.converters.certificates.marriagecertificates.helpers;
 
 import org.springframework.stereotype.Component;
 import scot.carricksoftware.grants.commands.certificates.marriagecertificates.MarriageCertificateCommand;

+ 66 - 0
src/test/java/scot/carricksoftware/grants/converters/certificates/marriagecertificates/MarriageCertificateBrideCommandConverterTest.java

@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grants.converters.certificates.marriagecertificates;
+
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import scot.carricksoftware.grants.commands.certificates.marriagecertificates.MarriageCertificateCommand;
+import scot.carricksoftware.grants.commands.certificates.marriagecertificates.MarriageCertificateCommandImpl;
+import scot.carricksoftware.grants.converters.certificates.marriagecertificates.helpers.MarriageCertificateBrideCommandConverter;
+import scot.carricksoftware.grants.converters.certificates.marriagecertificates.helpers.MarriageCertificateBrideCommandConverterImpl;
+import scot.carricksoftware.grants.domains.certificates.MarriageCertificate;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
+import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
+import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomPlace;
+
+class MarriageCertificateBrideCommandConverterTest {
+
+    private MarriageCertificateBrideCommandConverter converter;
+   
+    private MarriageCertificateCommand source;
+    private MarriageCertificate target;
+
+    @BeforeEach
+    void setUp() {
+        converter = new MarriageCertificateBrideCommandConverterImpl();
+        source = new MarriageCertificateCommandImpl();
+        target = new MarriageCertificate();
+    }
+
+    @Test
+    void convertTest() {
+        source.setBride(GetRandomPerson());
+        source.setBrideUsualResidence(GetRandomPlace());
+        source.setBrideAge(GetRandomString());
+        source.setBrideCondition(GetRandomString());
+        source.setBrideFather(GetRandomPerson());
+        source.setBrideFatherRank(GetRandomString());
+        source.setBrideRank(GetRandomString());
+        source.setBrideUntrackedFather(GetRandomString());
+        source.setBrideUntrackedResidence(GetRandomString());
+        source.setBrideUsualResidence(GetRandomPlace());
+
+        converter.convert(source, target);
+
+        assertEquals(source.getBride(),target.getBride());
+        assertEquals(source.getBrideUsualResidence(),target.getBrideUsualResidence());
+        assertEquals(source.getBrideAge(),target.getBrideAge());
+        assertEquals(source.getBrideCondition(),target.getBrideCondition());
+        assertEquals(source.getBrideFather(),target.getBrideFather());
+        assertEquals(source.getBrideFatherRank(),target.getBrideFatherRank());
+        assertEquals(source.getBrideRank(),target.getBrideRank());
+        assertEquals(source.getBrideUntrackedFather(),target.getBrideUntrackedFather());
+        assertEquals(source.getBrideUntrackedResidence(),target.getBrideUntrackedResidence());
+        assertEquals(source.getBrideUsualResidence(),target.getBrideUsualResidence());
+        
+  
+
+    }
+
+}

+ 1 - 0
src/test/java/scot/carricksoftware/grants/converters/certificates/marriagecertificates/MarriageCertificateCommandConverterTest.java

@@ -13,6 +13,7 @@ import org.mockito.Mock;
 import org.mockito.junit.jupiter.MockitoExtension;
 import scot.carricksoftware.grants.commands.certificates.marriagecertificates.MarriageCertificateCommand;
 import scot.carricksoftware.grants.commands.certificates.marriagecertificates.MarriageCertificateCommandImpl;
+import scot.carricksoftware.grants.converters.certificates.marriagecertificates.helpers.MarriageCertificateBrideCommandConverter;
 import scot.carricksoftware.grants.domains.certificates.MarriageCertificate;
 import scot.carricksoftware.grants.enums.certificates.CertificateType;