Bläddra i källkod

DeathCertificateNullFieldsValidatorTest (2)

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

+ 2 - 2
src/main/java/scot/carricksoftware/grants/constants/ValidationConstants.java

@@ -21,7 +21,7 @@ public class ValidationConstants {
     public static final String BOUNDARY_TYPE_IS_NULL = "The boundary type cannot be null.";
     public static final String BRIDE_IS_NULL = "The bride cannot be null.";
     public static final String CENSUS_IS_NULL = "The census should be specified";
-    public static final String CAUSE_OF_DEATH_IS_NULL = "The cause of death should be specified";
+    public static final String CAUSE_OF_DEATH_IS_NULL = "The cause of death should be specified.";
     public static final String CENSUS_NAME_IS_NOT_NULL = "Both Person and Untracked Person cannot be given";
     public static final String CENSUS_NAME_IS_NULL = "Either Person or Untracked Person must be given";
     public static final String CERTIFICATE_DATE_IS_NULL = "The certificate date cannot be null.";
@@ -38,7 +38,7 @@ public class ValidationConstants {
     public static final String FIELD_NOT_NEGATIVE_INTEGER = "Not a non negative integer.";
     public static final String FIRST_PARTY_IS_NULL = "The first party cannot be null.";
     public static final String GROOM_IS_NULL = "The groom cannot be null.";
-    public static final String INFORMANT_QUALIFICATION_IS_NULL = "Informant Qualification must exist.";
+    public static final String INFORMANT_QUALIFICATION_IS_NULL = "The informant qualification cannot be null.";
     public static final String INFORMANT_AND_UNTRACKED_INFORMANT = "One and only one informant and untracked informant may be specified.";
     public static final String MOTHER_AND_UNTRACKED_MOTHER = "One and only one mother and untracked mother may be specified.";
     public static final String MOTHER_IS_NULL = "The mother cannot be null.";

+ 15 - 3
src/test/java/scot/carricksoftware/grants/validators/certificates/deathcertificate/DeathCertificateNullFieldsValidatorImplTest.java

@@ -36,9 +36,12 @@ class DeathCertificateNullFieldsValidatorImplTest {
     private BindingResult bindingResultMock;
 
     DeathCertificateCommand deathCertificateCommand;
-Person deceased;
-String certificateNumber;
-String volume;
+    Person deceased;
+    String certificateNumber;
+    String volume;
+    String number;
+    String causeOfDeath;
+    String informantQualification;
 
     @BeforeEach
     void setUp() {
@@ -47,9 +50,15 @@ String volume;
         deceased = GetRandomPerson();
         certificateNumber = GetRandomString();
         volume = GetRandomString();
+        number = GetRandomString();
+        causeOfDeath = GetRandomString();
+        informantQualification = GetRandomString();
         deathCertificateCommand.setDeceased(deceased);
         deathCertificateCommand.setCertificateNumber(certificateNumber);
         deathCertificateCommand.setVolume(volume);
+        deathCertificateCommand.setNumber(number);
+        deathCertificateCommand.setCauseOfDeath(causeOfDeath);
+        deathCertificateCommand.setInformantQualification(informantQualification);
     }
 
     @Test
@@ -59,6 +68,9 @@ String volume;
         verify(validateTypesMock).validatePerson(deceased, "deceased", "The deceased cannot be null.", bindingResultMock);
         verify(validateTypesMock).validateNullOrEmptyString(certificateNumber, "certificateNumber", "The certificate number cannot be null.", bindingResultMock);
         verify(validateTypesMock).validateNullOrEmptyString(volume, "volume", "The volume cannot be null.", bindingResultMock);
+        verify(validateTypesMock).validateNullOrEmptyString(number, "number", "The number cannot be null.", bindingResultMock);
+        verify(validateTypesMock).validateNullOrEmptyString(causeOfDeath, "causeOfDeath", "The cause of death should be specified.", bindingResultMock);
+        verify(validateTypesMock).validateNullOrEmptyString(informantQualification, "informantQualification", "The informant qualification cannot be null.", bindingResultMock);
     }