|
|
@@ -13,12 +13,10 @@ import org.mockito.junit.jupiter.MockitoExtension;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import scot.carricksoftware.grants.commands.text.PersonTextCommand;
|
|
|
import scot.carricksoftware.grants.commands.text.PersonTextCommandImpl;
|
|
|
-import scot.carricksoftware.grants.domains.people.Person;
|
|
|
import scot.carricksoftware.grants.validators.helpers.ValidateTypes;
|
|
|
|
|
|
import static org.mockito.Mockito.verify;
|
|
|
import static scot.carricksoftware.grants.GenerateCertificateRandomValues.GetRandomString;
|
|
|
-import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
|
|
|
|
|
|
@ExtendWith(MockitoExtension.class)
|
|
|
class PersonTextCommandValidatorImplTest {
|
|
|
@@ -51,12 +49,14 @@ class PersonTextCommandValidatorImplTest {
|
|
|
"The order must be non-negative.", bindingResultMock);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@Test
|
|
|
void validateLevelIsCalledTest() {
|
|
|
String level = GetRandomString();
|
|
|
personTextCommand.setLevel(level);
|
|
|
validator.validate(personTextCommand, bindingResultMock);
|
|
|
- verify(validateTypesMock).validateIntegerRange(level,
|
|
|
+ verify(validateTypesMock).validateIntegerStaredRange(level,
|
|
|
-2,
|
|
|
5,
|
|
|
"level",
|
|
|
@@ -65,15 +65,4 @@ class PersonTextCommandValidatorImplTest {
|
|
|
"Level must be between -2 and 5.", bindingResultMock);
|
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
- void validatePersonIsCalledTest() {
|
|
|
- Person person = GetRandomPerson();
|
|
|
- personTextCommand.setPerson(person);
|
|
|
- validator.validate(personTextCommand, bindingResultMock);
|
|
|
- verify(validateTypesMock).validatePerson(person,
|
|
|
- "person",
|
|
|
- "The person cannot be null.",
|
|
|
- bindingResultMock);
|
|
|
- }
|
|
|
-
|
|
|
}
|