Browse Source

Certificate Registration in command

Andrew Grant 6 months ago
parent
commit
905fd98af7

+ 13 - 0
src/main/java/scot/carricksoftware/grants/commands/certificates/birthcertificates/BirthCertificateCommand.java

@@ -7,6 +7,7 @@ package scot.carricksoftware.grants.commands.certificates.birthcertificates;
 
 import scot.carricksoftware.grants.domains.people.Person;
 import scot.carricksoftware.grants.domains.places.Organisation;
+import scot.carricksoftware.grants.domains.places.Place;
 import scot.carricksoftware.grants.enums.certificates.CertificateType;
 
 public interface BirthCertificateCommand {
@@ -40,4 +41,16 @@ public interface BirthCertificateCommand {
     CertificateType getCertificateType();
 
     void setCertificateType(CertificateType certificateType);
+
+    Place getRegistrationAuthority();
+
+    void setRegistrationAuthority(Place registrationAuthority);
+
+    String getVolume();
+
+    void setVolume(String volume);
+
+    String getNumber();
+
+    void setNumber(String number);
 }

+ 38 - 0
src/main/java/scot/carricksoftware/grants/commands/certificates/birthcertificates/BirthCertificateCommandImpl.java

@@ -7,6 +7,7 @@ package scot.carricksoftware.grants.commands.certificates.birthcertificates;
 
 import scot.carricksoftware.grants.domains.people.Person;
 import scot.carricksoftware.grants.domains.places.Organisation;
+import scot.carricksoftware.grants.domains.places.Place;
 import scot.carricksoftware.grants.enums.certificates.CertificateType;
 
 public class BirthCertificateCommandImpl implements BirthCertificateCommand {
@@ -23,6 +24,13 @@ public class BirthCertificateCommandImpl implements BirthCertificateCommand {
 
     private CertificateType certificateType;
 
+    private Place registrationAuthority;
+
+    private String volume;
+
+    private String number;
+
+
     public Long getId() {
         return Id;
     }
@@ -81,4 +89,34 @@ public class BirthCertificateCommandImpl implements BirthCertificateCommand {
     public void setCertificateType(CertificateType certificateType) {
         this.certificateType = certificateType;
     }
+
+    @Override
+    public Place getRegistrationAuthority() {
+        return registrationAuthority;
+    }
+
+    @Override
+    public void setRegistrationAuthority(Place registrationAuthority) {
+        this.registrationAuthority = registrationAuthority;
+    }
+
+    @Override
+    public String getVolume() {
+        return volume;
+    }
+
+    @Override
+    public void setVolume(String volume) {
+        this.volume = volume;
+    }
+
+    @Override
+    public String getNumber() {
+        return number;
+    }
+
+    @Override
+    public void setNumber(String number) {
+        this.number = number;
+    }
 }

+ 2 - 3
src/main/java/scot/carricksoftware/grants/services/census/censusentry/UpdateRecordedYearOfBirthImpl.java

@@ -31,7 +31,7 @@ public class UpdateRecordedYearOfBirthImpl implements UpdateRecordedYearOfBirth
 
     @Override
     public void updateRecordedYearOfBirth(CensusEntryCommand censusEntryCommand) {
-        logger.info("UpdateRecordedYearOfBirthImpl::updateRecordedYearOfBirth");
+        logger.debug("UpdateRecordedYearOfBirthImpl::updateRecordedYearOfBirth");
         Person person = censusEntryCommand.getPerson();
         if (!isNull(person)) {
             if (isNull(person.getRecordedYearOfBirth())) {
@@ -55,13 +55,12 @@ public class UpdateRecordedYearOfBirthImpl implements UpdateRecordedYearOfBirth
                     }
                 }
             }
-
         }
     }
 
     private void updateDate(Person person,
                             String dateString) {
-        logger.info("UpdateRecordedYearOfBirthImpl::Date");
+        logger.debug("UpdateRecordedYearOfBirthImpl::Date");
         PersonCommand personCommand = personConverter.convert(person);
         if (personCommand != null) {
             personCommand.setRecordedYearOfBirth(dateString);

+ 64 - 0
src/test/java/scot/carricksoftware/grants/commands/certificates/BirthCertificateCommandRegistrationTest.java

@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) Andrew Grant of Carrick Software 24/03/2025, 17:31. All rights reserved.
+ *
+ */
+
+package scot.carricksoftware.grants.commands.certificates;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommand;
+import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommandImpl;
+import scot.carricksoftware.grants.domains.places.Place;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
+import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomPlace;
+
+class BirthCertificateCommandRegistrationTest {
+
+    private BirthCertificateCommand command;
+
+    @BeforeEach
+    void setUp() {
+        command = new BirthCertificateCommandImpl();
+    }
+
+    @Test
+    void getRegistrationAuthorityTest() {
+        assertNull(command.getRegistrationAuthority());
+    }
+
+    @Test
+    void setRegistrationAuthorityTest() {
+        Place registrationAuthority = GetRandomPlace();
+        command.setRegistrationAuthority(registrationAuthority);
+        assertEquals(registrationAuthority, command.getRegistrationAuthority());
+    }
+
+    @Test
+    void getVolumeTest() {
+        assertNull(command.getVolume());
+    }
+
+    @Test
+    void setVolumeTest() {
+        String volume = GetRandomString();
+        command.setVolume(volume);
+        assertEquals(volume, command.getVolume());
+    }
+
+    @Test
+    void getNumberTest() {
+        assertNull(command.getNumber());
+    }
+
+    @Test
+    void setNumberTest() {
+        String number = GetRandomString();
+        command.setNumber(number);
+        assertEquals(number, command.getNumber());
+    }
+
+}

+ 1 - 1
src/test/java/scot/carricksoftware/grants/commands/certificates/BirthCertificateCommandImplTest.java → src/test/java/scot/carricksoftware/grants/commands/certificates/BirthCertificateCommandTest.java

@@ -20,7 +20,7 @@ import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLo
 import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
 import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomOrganisation;
 
-class BirthCertificateCommandImplTest {
+class BirthCertificateCommandTest {
 
     private BirthCertificateCommand command;
 

+ 1 - 1
src/test/java/scot/carricksoftware/grants/commands/certificates/DeathCertificateCommandImplTest.java → src/test/java/scot/carricksoftware/grants/commands/certificates/DeathCertificateCommandTest.java

@@ -13,7 +13,7 @@ import scot.carricksoftware.grants.commands.certificates.deathcertificates.Death
 import static org.junit.jupiter.api.Assertions.*;
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
 
-class DeathCertificateCommandImplTest {
+class DeathCertificateCommandTest {
 
     private DeathCertificateCommand command;
 

+ 1 - 1
src/test/java/scot/carricksoftware/grants/commands/certificates/DivorceCertificateCommandImplTest.java → src/test/java/scot/carricksoftware/grants/commands/certificates/DivorceCertificateCommandTest.java

@@ -16,7 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
 import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
 
-class DivorceCertificateCommandImplTest {
+class DivorceCertificateCommandTest {
 
     private DivorceCertificateCommand command;
 

+ 1 - 1
src/test/java/scot/carricksoftware/grants/commands/certificates/MarriageCertificateCommandImplTest.java → src/test/java/scot/carricksoftware/grants/commands/certificates/MarriageCertificateCommandTest.java

@@ -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 MarriageCertificateCommandImplTest {
+class MarriageCertificateCommandTest {
 
     private MarriageCertificateCommand command;