Ver Fonte

Divorce certificate command Test

Andrew Grant há 3 meses atrás
pai
commit
270595dc73

+ 16 - 0
src/main/java/scot/carricksoftware/grants/commands/certificates/divorcecertificates/DivorceCertificateCommand.java

@@ -22,5 +22,21 @@ public interface DivorceCertificateCommand {
 
     void setSecondParty(Person secondParty);
 
+    @SuppressWarnings("unused")
+    String getRegisteredDate();
 
+    @SuppressWarnings("unused")
+    void setRegisteredDate(String registeredDate);
+
+    @SuppressWarnings("unused")
+    String getFirstPartyDate();
+
+    @SuppressWarnings("unused")
+    void setFirstPartyDate(String firstPartyDate);
+
+    @SuppressWarnings("unused")
+    String getSecondPartyDate();
+
+    @SuppressWarnings("unused")
+    void setSecondPartyDate(String secondPartyDate);
 }

+ 44 - 4
src/main/java/scot/carricksoftware/grants/commands/certificates/divorcecertificates/DivorceCertificateCommandImpl.java

@@ -15,30 +15,70 @@ public class DivorceCertificateCommandImpl implements DivorceCertificateCommand
 
     private Person secondParty;
 
+    private String registeredDate;
+
+    private String firstPartyDate;
+
+    private String secondPartyDate;
+
+
+    @Override
+    public Long getId() {
+        return Id;
+    }
+
+    @Override
+    public void setId(Long id) {
+        Id = id;
+    }
+
+    @Override
     public Person getFirstParty() {
         return firstParty;
     }
 
+    @Override
     public void setFirstParty(Person firstParty) {
         this.firstParty = firstParty;
     }
 
+    @Override
     public Person getSecondParty() {
         return secondParty;
     }
 
+    @Override
     public void setSecondParty(Person secondParty) {
         this.secondParty = secondParty;
     }
 
+    @Override
+    public String getRegisteredDate() {
+        return registeredDate;
+    }
 
-    public Long getId() {
-        return Id;
+    @Override
+    public void setRegisteredDate(String registeredDate) {
+        this.registeredDate = registeredDate;
     }
 
-    public void setId(Long id) {
-        Id = id;
+    @Override
+    public String getFirstPartyDate() {
+        return firstPartyDate;
     }
 
+    @Override
+    public void setFirstPartyDate(String firstPartyDate) {
+        this.firstPartyDate = firstPartyDate;
+    }
 
+    @Override
+    public String getSecondPartyDate() {
+        return secondPartyDate;
+    }
+
+    @Override
+    public void setSecondPartyDate(String secondPartyDate) {
+        this.secondPartyDate = secondPartyDate;
+    }
 }

+ 62 - 0
src/test/java/scot/carricksoftware/grants/commands/certificates/divorce/DivorceCertificateCommandDateTest.java

@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grants.commands.certificates.divorce;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import scot.carricksoftware.grants.commands.certificates.divorcecertificates.DivorceCertificateCommand;
+import scot.carricksoftware.grants.commands.certificates.divorcecertificates.DivorceCertificateCommandImpl;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
+
+class DivorceCertificateCommandDateTest {
+
+    private DivorceCertificateCommand command;
+
+    private String date;
+
+    @BeforeEach
+    void setUp() {
+        command = new DivorceCertificateCommandImpl();
+        date = GetRandomString();
+    }
+
+    @Test
+    public void getRegisteredDateTest() {
+        assertNull(command.getRegisteredDate());
+    }
+
+    @Test
+    public void setRegisteredDateTest() {
+        command.setRegisteredDate(date);
+        assertEquals(date, command.getRegisteredDate());
+    }
+
+    @Test
+    public void getFirstPartyDateTest() {
+        assertNull(command.getFirstPartyDate());
+    }
+
+    @Test
+    public void setFirstPartyDateTest() {
+        command.setFirstPartyDate(date);
+        assertEquals(date, command.getFirstPartyDate());
+    }
+
+    @Test
+    public void getSecondPartyDateTest() {
+        assertNull(command.getSecondPartyDate());
+    }
+
+    @Test
+    public void setSecondPartyDateTest() {
+        command.setSecondPartyDate(date);
+        assertEquals(date, command.getSecondPartyDate());
+    }
+
+}

+ 38 - 0
src/test/java/scot/carricksoftware/grants/commands/certificates/divorce/DivorceCertificateCommandIDTest.java

@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
+ *
+ */
+
+package scot.carricksoftware.grants.commands.certificates.divorce;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import scot.carricksoftware.grants.commands.certificates.divorcecertificates.DivorceCertificateCommand;
+import scot.carricksoftware.grants.commands.certificates.divorcecertificates.DivorceCertificateCommandImpl;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
+
+class DivorceCertificateCommandIDTest {
+
+    private DivorceCertificateCommand command;
+
+    @BeforeEach
+    void setUp() {
+        command = new DivorceCertificateCommandImpl();
+    }
+
+    @Test
+    void getIdTest() {
+        assertNull(command.getId());
+    }
+
+    @Test
+    void setIdTest() {
+        Long id = GetRandomLong();
+        command.setId(id);
+        assertEquals(id, command.getId());
+    }
+
+}

+ 6 - 18
src/test/java/scot/carricksoftware/grants/commands/certificates/DivorceCertificateCommandTest.java → src/test/java/scot/carricksoftware/grants/commands/certificates/divorce/DivorceCertificateCommandPersonTest.java

@@ -1,9 +1,9 @@
 /*
- * Copyright (c) Andrew Grant of Carrick Software 24/03/2025, 17:31. All rights reserved.
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
  *
  */
 
-package scot.carricksoftware.grants.commands.certificates;
+package scot.carricksoftware.grants.commands.certificates.divorce;
 
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -13,28 +13,18 @@ import scot.carricksoftware.grants.domains.people.Person;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
-import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
 import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
 
-class DivorceCertificateCommandTest {
+class DivorceCertificateCommandPersonTest {
 
     private DivorceCertificateCommand command;
 
+    private Person person;
+
     @BeforeEach
     void setUp() {
         command = new DivorceCertificateCommandImpl();
-    }
-
-    @Test
-    void getIdTest() {
-        assertNull(command.getId());
-    }
-
-    @Test
-    void setIdTest() {
-        Long id = GetRandomLong();
-        command.setId(id);
-        assertEquals(id, command.getId());
+        person = GetRandomPerson();
     }
 
     @Test
@@ -44,7 +34,6 @@ class DivorceCertificateCommandTest {
 
     @Test
     public void setFirstPartyTest() {
-        Person person = GetRandomPerson();
         command.setFirstParty(person);
         assertEquals(person, command.getFirstParty());
     }
@@ -56,7 +45,6 @@ class DivorceCertificateCommandTest {
 
     @Test
     public void setSecondPartyTest() {
-        Person person = GetRandomPerson();
         command.setSecondParty(person);
         assertEquals(person, command.getSecondParty());
     }

+ 3 - 3
src/test/java/scot/carricksoftware/grants/commands/certificates/MarriageCertificateCommandTest.java → src/test/java/scot/carricksoftware/grants/commands/certificates/marriage/MarriageCertificateCommandIDTest.java

@@ -1,9 +1,9 @@
 /*
- * Copyright (c) Andrew Grant of Carrick Software 24/03/2025, 17:31. All rights reserved.
+ * Copyright (c) 2025.  Andrew Grant Carrick Software. All rights reserved
  *
  */
 
-package scot.carricksoftware.grants.commands.certificates;
+package scot.carricksoftware.grants.commands.certificates.marriage;
 
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -14,7 +14,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
 
-class MarriageCertificateCommandTest {
+class MarriageCertificateCommandIDTest {
 
     private MarriageCertificateCommand command;