|
@@ -12,8 +12,6 @@ import org.mockito.Mock;
|
|
|
import org.mockito.junit.jupiter.MockitoExtension;
|
|
import org.mockito.junit.jupiter.MockitoExtension;
|
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.BindingResult;
|
|
|
import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommand;
|
|
import scot.carricksoftware.grants.commands.certificates.birthcertificates.BirthCertificateCommand;
|
|
|
-import scot.carricksoftware.grants.domains.people.Person;
|
|
|
|
|
-import scot.carricksoftware.grants.domains.places.Place;
|
|
|
|
|
import scot.carricksoftware.grants.enums.general.Sex;
|
|
import scot.carricksoftware.grants.enums.general.Sex;
|
|
|
import scot.carricksoftware.grants.validators.helpers.ValidateTypes;
|
|
import scot.carricksoftware.grants.validators.helpers.ValidateTypes;
|
|
|
import scot.carricksoftware.grants.validators.helpers.ValidateTwoFieldTypes;
|
|
import scot.carricksoftware.grants.validators.helpers.ValidateTwoFieldTypes;
|
|
@@ -21,8 +19,6 @@ import scot.carricksoftware.grants.validators.helpers.ValidateTwoFieldTypes;
|
|
|
import static org.mockito.Mockito.verify;
|
|
import static org.mockito.Mockito.verify;
|
|
|
import static org.mockito.Mockito.when;
|
|
import static org.mockito.Mockito.when;
|
|
|
import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
|
|
import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
|
|
|
-import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
|
|
|
|
|
-import static scot.carricksoftware.grants.GenerateRandomPlaceValues.GetRandomPlace;
|
|
|
|
|
|
|
|
|
|
@ExtendWith(MockitoExtension.class)
|
|
@ExtendWith(MockitoExtension.class)
|
|
|
class BirthCertificateCommandPartThreeValidatorTest {
|
|
class BirthCertificateCommandPartThreeValidatorTest {
|
|
@@ -54,37 +50,6 @@ class BirthCertificateCommandPartThreeValidatorTest {
|
|
|
verify(validateTypesMock).validateSex(sex, "sex", "Sex cannot be null.", bindingResultMock);
|
|
verify(validateTypesMock).validateSex(sex, "sex", "Sex cannot be null.", bindingResultMock);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Test
|
|
|
|
|
- void validateFatherAndUntrackedFatherTest() {
|
|
|
|
|
- String untrackedFather = GetRandomString();
|
|
|
|
|
- Person father = GetRandomPerson();
|
|
|
|
|
- when(birthCertificateCommandMock.getUntrackedFather()).thenReturn(untrackedFather);
|
|
|
|
|
- when(birthCertificateCommandMock.getFather()).thenReturn(father);
|
|
|
|
|
- validator.validate(birthCertificateCommandMock, bindingResultMock);
|
|
|
|
|
- verify(validateTypesMock).validatePersonAndUntrackedPerson(
|
|
|
|
|
- father,
|
|
|
|
|
- untrackedFather,
|
|
|
|
|
- "father",
|
|
|
|
|
- "untrackedFather",
|
|
|
|
|
- "One and only one father and untracked father must be specified.",
|
|
|
|
|
- bindingResultMock);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Test
|
|
|
|
|
- void validateWhereBornAndUntrackedWhereBornTest() {
|
|
|
|
|
- String untrackedWhereBorn = GetRandomString();
|
|
|
|
|
- Place whereBorn = GetRandomPlace();
|
|
|
|
|
- when(birthCertificateCommandMock.getUntrackedWhereBorn()).thenReturn(untrackedWhereBorn);
|
|
|
|
|
- when(birthCertificateCommandMock.getWhereBorn()).thenReturn(whereBorn);
|
|
|
|
|
- validator.validate(birthCertificateCommandMock, bindingResultMock);
|
|
|
|
|
- verify(validateTypesMock).validatePlaceAndUntrackedPlace(
|
|
|
|
|
- whereBorn,
|
|
|
|
|
- untrackedWhereBorn,
|
|
|
|
|
- "whereBorn",
|
|
|
|
|
- "untrackedWhereBorn",
|
|
|
|
|
- "One and only one where born and untracked where born must be specified.",
|
|
|
|
|
- bindingResultMock);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
|
void validateWhenBornTest() {
|
|
void validateWhenBornTest() {
|