Browse Source

When registered validated test

Andrew Grant 5 months ago
parent
commit
58bc049fba

+ 15 - 1
src/test/java/scot/carricksoftware/grants/validators/certificates/birthcertificate/BirthCertificateCommandPartThreeValidatorTest.java

@@ -83,7 +83,7 @@ class BirthCertificateCommandPartThreeValidatorTest {
     }
 
     @Test
-    void validateWhenBornTestTest() {
+    void validateWhenBornTest() {
         validator.validate(birthCertificateCommandMock, bindingResultMock);
         verify(validateTypesMock).validatePastDateAndTime(
                 birthCertificateCommandMock.getWhenBorn(),
@@ -94,4 +94,18 @@ class BirthCertificateCommandPartThreeValidatorTest {
                 bindingResultMock);
     }
 
+    @Test
+    void validateRegisteredDateTest() {
+        String string = GetRandomString();
+        when(birthCertificateCommandMock.getWhenRegistered()).thenReturn(string);
+        validator.validate(birthCertificateCommandMock, bindingResultMock);
+        verify(validateTypesMock).validatePastDate(
+                string,
+                "whenRegistered",
+                "When registered cannot be null.",
+                "When registered date is invalid.",
+                "Date should not be in the future.",
+                bindingResultMock);
+    }
+
 }