Przeglądaj źródła

ValidateTypes::validateDatePast

Andrew Grant 6 miesięcy temu
rodzic
commit
ea3e96704c

+ 0 - 16
src/main/java/scot/carricksoftware/grants/validators/certificates/BirthCertificateCommandPartOneValidator.java

@@ -36,9 +36,6 @@ public class BirthCertificateCommandPartOneValidator {
         validateCertificateSource(birthCertificateCommand, bindingResult);
         validateCertificateType(birthCertificateCommand, bindingResult);
         validateCertificateDate(birthCertificateCommand, bindingResult);
-        if (!bindingResult.hasErrors()) {
-            validateCertificateLegitimateDate(birthCertificateCommand, bindingResult);
-        }
     }
 
     private void validateNewBorn(BirthCertificateCommand birthCertificateCommand, BindingResult bindingResult) {
@@ -83,19 +80,6 @@ public class BirthCertificateCommandPartOneValidator {
         }
     }
 
-    private void validateCertificateLegitimateDate(BirthCertificateCommand birthCertificateCommand, BindingResult bindingResult) {
-        logger.debug("Validating birth Certificate valid date");
-        try {
-            LocalDate testDate = LocalDate.parse(birthCertificateCommand.getCertificateDate(), ApplicationConstants.FORMATTER);
-            if (testDate.isAfter(LocalDate.now())) {
-                bindingResult.rejectValue("certificateDate", ApplicationConstants.EMPTY_STRING,
-                        null,
-                        ValidationConstants.DATE_IN_FUTURE);
-            }
-        } catch (Exception e) {
-            logger.debug("Error trapped in  birth Certificate valid date");
-        }
-    }
 
 
 }

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

@@ -71,7 +71,14 @@ class BirthCertificateCommandTest {
     }
 
     @Test
-    void setCertificateDateTest() {
+    void setCertificateDateNullTest() {
+        String certificateDate = GetRandomString();
+        command.setCertificateDate(certificateDate);
+        assertEquals(certificateDate, command.getCertificateDate());
+    }
+
+    @Test
+    void setCertificateDateEmptyTest() {
         String certificateDate = GetRandomString();
         command.setCertificateDate(certificateDate);
         assertEquals(certificateDate, command.getCertificateDate());

+ 0 - 138
src/test/java/scot/carricksoftware/grants/validators/certificates/BirthCertificateCommandPartOneValidatorDateTest.java

@@ -1,138 +0,0 @@
-/*
- * Copyright (c) Andrew Grant of Carrick Software 19/03/2025, 11:37. All rights reserved.
- *
- */
-
-package scot.carricksoftware.grants.validators.certificates;
-
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.springframework.validation.BindingResult;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommand;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommandImpl;
-import scot.carricksoftware.grants.enums.certificates.CertificateType;
-import scot.carricksoftware.grants.validators.helpers.ValidateTypesImpl;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
-import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
-import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomOrganisation;
-
-@ExtendWith(MockitoExtension.class)
-class BirthCertificateCommandPartOneValidatorDateTest {
-
-    private BirthCertificateCommandPartOneValidator commandValidator;
-
-    private ArgumentCaptor<String> stringArgumentCaptor;
-    private ArgumentCaptor<String> stringArgumentCaptor2;
-    private ArgumentCaptor<String> stringArgumentCaptor3;
-    private ArgumentCaptor<Object[]> objectArgumentCaptor;
-
-    private BirthCertificateCommand birthCertificateCommand;
-
-    @Mock
-    BindingResult bindingResultMock;
-
-    ValidateTypesImpl validateTypes;
-
-    @BeforeEach
-    void setUp() {
-        validateTypes = new ValidateTypesImpl();
-        commandValidator = new BirthCertificateCommandPartOneValidator(validateTypes);
-        stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor2 = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor3 = ArgumentCaptor.forClass(String.class);
-        objectArgumentCaptor = ArgumentCaptor.forClass(Object[].class);
-
-        birthCertificateCommand = new BirthCertificateCommandImpl();
-    }
-
-
-    @Test
-    public void certificateInvalidDateTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateNumber(GetRandomString());
-        birthCertificateCommand.setCertificateDate(GetRandomString());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        when(bindingResultMock.hasErrors()).thenReturn(false);
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("certificateDate", stringArgumentCaptor.getValue());
-        assertEquals("The certificate date is invalid or of the wrong format.", stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    public void certificateFutureDateTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateNumber(GetRandomString());
-        birthCertificateCommand.setCertificateDate("01/01/2099");
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        when(bindingResultMock.hasErrors()).thenReturn(false);
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("certificateDate", stringArgumentCaptor.getValue());
-        assertEquals("Date should not be in the future.", stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    public void certificateNullDateTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateNumber(GetRandomString());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        when(bindingResultMock.hasErrors()).thenReturn(false);
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("certificateDate", stringArgumentCaptor.getValue());
-        assertEquals("The certificate date cannot be null.", stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    public void certificateTypeNullTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateNumber(GetRandomString());
-        birthCertificateCommand.setCertificateType(null);
-        birthCertificateCommand.setCertificateDate("01/01/2019");
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        when(bindingResultMock.hasErrors()).thenReturn(false);
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("certificateType", stringArgumentCaptor.getValue());
-        assertEquals("The certificate type cannot be null.", stringArgumentCaptor3.getValue());
-    }
-
-
-}

+ 0 - 86
src/test/java/scot/carricksoftware/grants/validators/certificates/BirthCertificateCommandPartOneValidatorPersonTest.java

@@ -1,86 +0,0 @@
-/*
- * Copyright (c) Andrew Grant of Carrick Software 19/03/2025, 11:37. All rights reserved.
- *
- */
-
-package scot.carricksoftware.grants.validators.certificates;
-
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.springframework.validation.BindingResult;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommand;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommandImpl;
-import scot.carricksoftware.grants.enums.certificates.CertificateType;
-import scot.carricksoftware.grants.validators.helpers.ValidateTypes;
-import scot.carricksoftware.grants.validators.helpers.ValidateTypesImpl;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
-import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomOrganisation;
-
-@ExtendWith(MockitoExtension.class)
-class BirthCertificateCommandPartOneValidatorPersonTest {
-
-    private BirthCertificateCommandPartOneValidator commandValidator;
-
-    private ArgumentCaptor<String> stringArgumentCaptor;
-    private ArgumentCaptor<String> stringArgumentCaptor2;
-    private ArgumentCaptor<String> stringArgumentCaptor3;
-    private ArgumentCaptor<Object[]> objectArgumentCaptor;
-
-    private BirthCertificateCommand birthCertificateCommand;
-
-    @Mock
-    BindingResult bindingResultMock;
-
-    ValidateTypes validateTypes;
-
-    @BeforeEach
-    void setUp() {
-        validateTypes = new ValidateTypesImpl();
-        commandValidator = new BirthCertificateCommandPartOneValidator(validateTypes);
-        stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor2 = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor3 = ArgumentCaptor.forClass(String.class);
-        objectArgumentCaptor = ArgumentCaptor.forClass(Object[].class);
-
-        birthCertificateCommand = new BirthCertificateCommandImpl();
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setCertificateNumber("1953");
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-    }
-
-    @Test
-    public void nullPersonTest() {
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("newBorn", stringArgumentCaptor.getValue());
-        assertEquals("The New Born cannot be null.", stringArgumentCaptor3.getValue());
-
-    }
-
-    @Test
-    public void notNullPersonTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        when(bindingResultMock.hasErrors()).thenReturn(false);
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock, times(0)).rejectValue(any(), any(), any(), any());
-    }
-
-}

+ 0 - 136
src/test/java/scot/carricksoftware/grants/validators/certificates/BirthCertificateCommandValidatorPartFiveTest.java

@@ -1,136 +0,0 @@
-/*
- * Copyright (c) Andrew Grant of Carrick Software 19/03/2025, 11:37. All rights reserved.
- *
- */
-
-package scot.carricksoftware.grants.validators.certificates;
-
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.springframework.validation.BindingResult;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommand;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommandImpl;
-import scot.carricksoftware.grants.enums.censusentry.CensusEntrySex;
-import scot.carricksoftware.grants.enums.certificates.CertificateType;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.Mockito.verify;
-import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
-import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
-import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
-import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomOrganisation;
-
-@ExtendWith(MockitoExtension.class)
-class BirthCertificateCommandValidatorPartFiveTest {
-
-    private BirthCertificateCommandPartThreeValidator commandValidator;
-
-    private ArgumentCaptor<String> stringArgumentCaptor;
-    private ArgumentCaptor<String> stringArgumentCaptor2;
-    private ArgumentCaptor<String> stringArgumentCaptor3;
-    private ArgumentCaptor<Object[]> objectArgumentCaptor;
-
-    private BirthCertificateCommand birthCertificateCommand;
-
-    @Mock
-    BindingResult bindingResultMock;
-
-
-
-
-    @BeforeEach
-    void setUp() {
-        commandValidator = new BirthCertificateCommandPartThreeValidator();
-        stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor2 = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor3 = ArgumentCaptor.forClass(String.class);
-        objectArgumentCaptor = ArgumentCaptor.forClass(Object[].class);
-
-        birthCertificateCommand = new BirthCertificateCommandImpl();
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateNumber(Long.toString(GetRandomLong()));
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-    }
-
-    @Test
-    void nullSexTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNumber("99");
-        birthCertificateCommand.setVolume("02");
-        birthCertificateCommand.setSex(null);
-        birthCertificateCommand.setWhereBorn(GetRandomString());
-        birthCertificateCommand.setWhenBorn("25/01/1953 01:00");
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("sex", stringArgumentCaptor.getValue());
-        assertEquals("Sex cannot be null.", stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    void nullWhereBornTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNumber("99");
-        birthCertificateCommand.setVolume("02");
-        birthCertificateCommand.setSex(CensusEntrySex.FEMALE);
-        birthCertificateCommand.setWhereBorn(null);
-        birthCertificateCommand.setWhenBorn("25/01/1953 01:00");
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("whereBorn", stringArgumentCaptor.getValue());
-        assertEquals("Where born cannot be null.", stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    void emptyWhereBornTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNumber("99");
-        birthCertificateCommand.setVolume("02");
-        birthCertificateCommand.setSex(CensusEntrySex.FEMALE);
-        birthCertificateCommand.setWhereBorn("");
-        birthCertificateCommand.setWhenBorn("25/01/1953 01:00");
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("whereBorn", stringArgumentCaptor.getValue());
-        assertEquals("Where born cannot be null.", stringArgumentCaptor3.getValue());
-    }
-
-
-
-
-}

+ 0 - 77
src/test/java/scot/carricksoftware/grants/validators/certificates/BirthCertificateCommandValidatorPartFourTest.java

@@ -1,77 +0,0 @@
-/*
- * Copyright (c) Andrew Grant of Carrick Software 19/03/2025, 11:37. All rights reserved.
- *
- */
-
-package scot.carricksoftware.grants.validators.certificates;
-
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.springframework.validation.BindingResult;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommand;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommandImpl;
-import scot.carricksoftware.grants.enums.certificates.CertificateType;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.Mockito.verify;
-import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
-import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
-import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomOrganisation;
-
-@ExtendWith(MockitoExtension.class)
-class BirthCertificateCommandValidatorPartFourTest {
-
-    private BirthCertificateCommandPartTwoValidator commandValidator;
-
-    private ArgumentCaptor<String> stringArgumentCaptor;
-    private ArgumentCaptor<String> stringArgumentCaptor2;
-    private ArgumentCaptor<String> stringArgumentCaptor3;
-    private ArgumentCaptor<Object[]> objectArgumentCaptor;
-
-    private BirthCertificateCommand birthCertificateCommand;
-
-    @Mock
-    BindingResult bindingResultMock;
-
-    @BeforeEach
-    void setUp() {
-        commandValidator = new BirthCertificateCommandPartTwoValidator();
-        stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor2 = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor3 = ArgumentCaptor.forClass(String.class);
-        objectArgumentCaptor = ArgumentCaptor.forClass(Object[].class);
-
-        birthCertificateCommand = new BirthCertificateCommandImpl();
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateNumber(Long.toString(GetRandomLong()));
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-    }
-
-    @Test
-    void nullRegistrationAuthorityTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNumber("99");
-        birthCertificateCommand.setVolume("10");
-        birthCertificateCommand.setRegistrationAuthority(null);
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("registrationAuthority", stringArgumentCaptor.getValue());
-        assertEquals("The registration authority cannot be null.", stringArgumentCaptor3.getValue());
-    }
-
-}

+ 0 - 117
src/test/java/scot/carricksoftware/grants/validators/certificates/BirthCertificateCommandValidatorPartOneTest.java

@@ -1,117 +0,0 @@
-/*
- * Copyright (c) Andrew Grant of Carrick Software 19/03/2025, 11:37. All rights reserved.
- *
- */
-
-package scot.carricksoftware.grants.validators.certificates;
-
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.springframework.validation.BindingResult;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommand;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommandImpl;
-import scot.carricksoftware.grants.enums.certificates.CertificateType;
-import scot.carricksoftware.grants.validators.helpers.ValidateTypes;
-import scot.carricksoftware.grants.validators.helpers.ValidateTypesImpl;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
-import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
-import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomOrganisation;
-
-@ExtendWith(MockitoExtension.class)
-class BirthCertificateCommandValidatorPartOneTest {
-
-    private BirthCertificateCommandPartOneValidator commandValidator;
-
-    private ArgumentCaptor<String> stringArgumentCaptor;
-    private ArgumentCaptor<String> stringArgumentCaptor2;
-    private ArgumentCaptor<String> stringArgumentCaptor3;
-    private ArgumentCaptor<Object[]> objectArgumentCaptor;
-
-    private BirthCertificateCommand birthCertificateCommand;
-
-    @Mock
-    BindingResult bindingResultMock;
-
-    ValidateTypes validateTypes;
-
-    @BeforeEach
-    void setUp() {
-        validateTypes = new ValidateTypesImpl();
-        commandValidator = new BirthCertificateCommandPartOneValidator(validateTypes);
-        stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor2 = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor3 = ArgumentCaptor.forClass(String.class);
-        objectArgumentCaptor = ArgumentCaptor.forClass(Object[].class);
-
-        birthCertificateCommand = new BirthCertificateCommandImpl();
-    }
-
-    @Test
-    public void certificateNumberTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("certificateNumber", stringArgumentCaptor.getValue());
-        assertEquals("The certificate number cannot be null.", stringArgumentCaptor3.getValue());
-
-    }
-
-    @Test
-    public void certificateSourceTest() {
-
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateNumber(GetRandomString());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("certificateSource", stringArgumentCaptor.getValue());
-        assertEquals("The certificate source cannot be null.", stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    public void certificateInvalidDateTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateNumber(GetRandomString());
-        birthCertificateCommand.setCertificateDate(GetRandomString());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        when(bindingResultMock.hasErrors()).thenReturn(false);
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("certificateDate", stringArgumentCaptor.getValue());
-        assertEquals("The certificate date is invalid or of the wrong format.", stringArgumentCaptor3.getValue());
-    }
-
-
-}

+ 0 - 260
src/test/java/scot/carricksoftware/grants/validators/certificates/BirthCertificateCommandValidatorPartSixTest.java

@@ -1,260 +0,0 @@
-/*
- * Copyright (c) Andrew Grant of Carrick Software 19/03/2025, 11:37. All rights reserved.
- *
- */
-
-package scot.carricksoftware.grants.validators.certificates;
-
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.springframework.validation.BindingResult;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommand;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommandImpl;
-import scot.carricksoftware.grants.enums.censusentry.CensusEntrySex;
-import scot.carricksoftware.grants.enums.certificates.CertificateType;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.Mockito.verify;
-import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
-import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
-import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomOrganisation;
-
-@ExtendWith(MockitoExtension.class)
-class BirthCertificateCommandValidatorPartSixTest {
-
-    private BirthCertificateCommandPartThreeValidator commandValidator;
-
-    private ArgumentCaptor<String> stringArgumentCaptor;
-    private ArgumentCaptor<String> stringArgumentCaptor2;
-    private ArgumentCaptor<String> stringArgumentCaptor3;
-    private ArgumentCaptor<Object[]> objectArgumentCaptor;
-
-    private BirthCertificateCommand birthCertificateCommand;
-
-    @Mock
-    BindingResult bindingResultMock;
-
-
-
-
-    @BeforeEach
-    void setUp() {
-        commandValidator = new BirthCertificateCommandPartThreeValidator();
-        stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor2 = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor3 = ArgumentCaptor.forClass(String.class);
-        objectArgumentCaptor = ArgumentCaptor.forClass(Object[].class);
-
-        birthCertificateCommand = new BirthCertificateCommandImpl();
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateNumber(Long.toString(GetRandomLong()));
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-    }
-
-
-    @SuppressWarnings("SpellCheckingInspection")
-    @Test
-    void whereBornInvalidDateTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNumber("99");
-        birthCertificateCommand.setVolume("02");
-        birthCertificateCommand.setSex(CensusEntrySex.FEMALE);
-        birthCertificateCommand.setWhereBorn("Edinburgh");
-        birthCertificateCommand.setWhenBorn("xxxx 01:01");
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("whenBorn", stringArgumentCaptor.getValue());
-        assertEquals("The format should be dd/MM/yyyy hh:mm.", stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    void whereBornTooHighDayTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNumber("99");
-        birthCertificateCommand.setVolume("02");
-        birthCertificateCommand.setSex(CensusEntrySex.FEMALE);
-        birthCertificateCommand.setWhereBorn("Edinburgh");
-        birthCertificateCommand.setWhenBorn("33/01/1953 01:01");
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("whenBorn", stringArgumentCaptor.getValue());
-        assertEquals("The format should be dd/MM/yyyy hh:mm.", stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    void whereBornTooHighMonthTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNumber("99");
-        birthCertificateCommand.setVolume("02");
-        birthCertificateCommand.setSex(CensusEntrySex.FEMALE);
-        birthCertificateCommand.setWhereBorn("Edinburgh");
-        birthCertificateCommand.setWhenBorn("25/13/1953 01:01");
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("whenBorn", stringArgumentCaptor.getValue());
-        assertEquals("The format should be dd/MM/yyyy hh:mm.", stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    void whereBornTooHighYearTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNumber("99");
-        birthCertificateCommand.setVolume("02");
-        birthCertificateCommand.setSex(CensusEntrySex.FEMALE);
-        birthCertificateCommand.setWhereBorn("Edinburgh");
-        birthCertificateCommand.setWhenBorn("25/01/2053 01:01");
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("whenBorn", stringArgumentCaptor.getValue());
-        assertEquals("The format should be dd/MM/yyyy hh:mm.", stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    void whereBornTooHighHourTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNumber("99");
-        birthCertificateCommand.setVolume("02");
-        birthCertificateCommand.setSex(CensusEntrySex.FEMALE);
-        birthCertificateCommand.setWhereBorn("Edinburgh");
-        birthCertificateCommand.setWhenBorn("25/01/1953 25:01");
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("whenBorn", stringArgumentCaptor.getValue());
-        assertEquals("The format should be dd/MM/yyyy hh:mm.", stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    void whereBornTooHighMinuteTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNumber("99");
-        birthCertificateCommand.setVolume("02");
-        birthCertificateCommand.setSex(CensusEntrySex.FEMALE);
-        birthCertificateCommand.setWhereBorn("Edinburgh");
-        birthCertificateCommand.setWhenBorn("25/01/1953 10:67");
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("whenBorn", stringArgumentCaptor.getValue());
-        assertEquals("The format should be dd/MM/yyyy hh:mm.", stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    void whereBornTooExtraBitTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNumber("99");
-        birthCertificateCommand.setVolume("02");
-        birthCertificateCommand.setSex(CensusEntrySex.FEMALE);
-        birthCertificateCommand.setWhereBorn("Edinburgh");
-        birthCertificateCommand.setWhenBorn("25/01/1953 10:15:15");
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("whenBorn", stringArgumentCaptor.getValue());
-        assertEquals("The format should be dd/MM/yyyy hh:mm.", stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    void whereBornTooExtraBit2Test() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNumber("99");
-        birthCertificateCommand.setVolume("02");
-        birthCertificateCommand.setSex(CensusEntrySex.FEMALE);
-        birthCertificateCommand.setWhereBorn("Edinburgh");
-        birthCertificateCommand.setWhenBorn("25/01/1953 10:15 15");
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("whenBorn", stringArgumentCaptor.getValue());
-        assertEquals("The format should be dd/MM/yyyy hh:mm.", stringArgumentCaptor3.getValue());
-    }
-
-
-
-
-
-
-
-}

+ 0 - 98
src/test/java/scot/carricksoftware/grants/validators/certificates/BirthCertificateCommandValidatorPartThreeTest.java

@@ -1,98 +0,0 @@
-/*
- * Copyright (c) Andrew Grant of Carrick Software 19/03/2025, 11:37. All rights reserved.
- *
- */
-
-package scot.carricksoftware.grants.validators.certificates;
-
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.springframework.validation.BindingResult;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommand;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommandImpl;
-import scot.carricksoftware.grants.enums.certificates.CertificateType;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.Mockito.verify;
-import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
-import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
-import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomOrganisation;
-
-@ExtendWith(MockitoExtension.class)
-class BirthCertificateCommandValidatorPartThreeTest {
-
-    private BirthCertificateCommandPartTwoValidator commandValidator;
-
-    private ArgumentCaptor<String> stringArgumentCaptor;
-    private ArgumentCaptor<String> stringArgumentCaptor2;
-    private ArgumentCaptor<String> stringArgumentCaptor3;
-    private ArgumentCaptor<Object[]> objectArgumentCaptor;
-
-    private BirthCertificateCommand birthCertificateCommand;
-
-    @Mock
-    BindingResult bindingResultMock;
-
-    @BeforeEach
-    void setUp() {
-        commandValidator = new BirthCertificateCommandPartTwoValidator();
-        stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor2 = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor3 = ArgumentCaptor.forClass(String.class);
-        objectArgumentCaptor = ArgumentCaptor.forClass(Object[].class);
-
-        birthCertificateCommand = new BirthCertificateCommandImpl();
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateNumber(Long.toString(GetRandomLong()));
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-    }
-
-    @Test
-    void nullVolumeTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNumber("99");
-        birthCertificateCommand.setVolume(null);
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("volume", stringArgumentCaptor.getValue());
-        assertEquals("The volume cannot be null.", stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    void emptyVolumeTest() {
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNumber("99");
-        birthCertificateCommand.setVolume("");
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        birthCertificateCommand.setCertificateType(CertificateType.EXTRACT);
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("volume", stringArgumentCaptor.getValue());
-        assertEquals("The volume cannot be null.", stringArgumentCaptor3.getValue());
-    }
-
-}

+ 0 - 111
src/test/java/scot/carricksoftware/grants/validators/certificates/BirthCertificateCommandValidatorPartTwoTest.java

@@ -1,111 +0,0 @@
-/*
- * Copyright (c) Andrew Grant of Carrick Software 19/03/2025, 11:37. All rights reserved.
- *
- */
-
-package scot.carricksoftware.grants.validators.certificates;
-
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.springframework.validation.BindingResult;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommand;
-import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommandImpl;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoInteractions;
-import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
-import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
-import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
-import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomOrganisation;
-
-@ExtendWith(MockitoExtension.class)
-class BirthCertificateCommandValidatorPartTwoTest {
-
-    private BirthCertificateCommandPartTwoValidator commandValidator;
-
-    private ArgumentCaptor<String> stringArgumentCaptor;
-    private ArgumentCaptor<String> stringArgumentCaptor2;
-    private ArgumentCaptor<String> stringArgumentCaptor3;
-    private ArgumentCaptor<Object[]> objectArgumentCaptor;
-
-    private BirthCertificateCommand birthCertificateCommand;
-
-    @Mock
-    BindingResult bindingResultMock;
-
-    @BeforeEach
-    void setUp() {
-        commandValidator = new BirthCertificateCommandPartTwoValidator();
-        stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor2 = ArgumentCaptor.forClass(String.class);
-        stringArgumentCaptor3 = ArgumentCaptor.forClass(String.class);
-        objectArgumentCaptor = ArgumentCaptor.forClass(Object[].class);
-
-        birthCertificateCommand = new BirthCertificateCommandImpl();
-        birthCertificateCommand.setCertificateDate("25/01/1953");
-        birthCertificateCommand.setNewBorn(GetRandomPerson());
-        birthCertificateCommand.setCertificateNumber(Long.toString(GetRandomLong()));
-        birthCertificateCommand.setCertificateSource(GetRandomOrganisation());
-    }
-
-    @Test
-    void aNullNumberIsInvalidTest() {
-        numberTest(null, "The number cannot be null.");
-    }
-
-    @Test
-    void anEmptyNumberIsInvalidTest() {
-        numberTest(" ", "The number must be a non negative integer.");
-    }
-
-    @Test
-    void anNegativeNumberIsInvalidTest() {
-        numberTest("-1", "The number must be a non negative integer.");
-    }
-
-    @Test
-    void aRealNumberIsInvalidTest() {
-        numberTest("3.15", "The number must be a non negative integer.");
-    }
-
-    @Test
-    void aNonNumberIsInvalidTest() {
-        numberTest("zzz", "The number must be a non negative integer.");
-    }
-
-
-    private void numberTest(String testValue, String error) {
-        birthCertificateCommand.setNumber(testValue);
-        birthCertificateCommand.setVolume(GetRandomString());
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-
-        verify(bindingResultMock).rejectValue(stringArgumentCaptor.capture(),
-                stringArgumentCaptor2.capture(),
-                objectArgumentCaptor.capture(),
-                stringArgumentCaptor3.capture());
-
-        assertEquals("number", stringArgumentCaptor.getValue());
-        assertEquals(error, stringArgumentCaptor3.getValue());
-    }
-
-    @Test
-    void zeroIsAnAValidNumberTest() {
-        birthCertificateCommand.setNumber("0");
-        birthCertificateCommand.setVolume(GetRandomString());
-        birthCertificateCommand.setRegistrationAuthority(GetRandomOrganisation());
-        commandValidator.validate(birthCertificateCommand, bindingResultMock);
-
-        verifyNoInteractions(bindingResultMock);
-
-    }
-
-
-}