Update UserNotNullUnitTest.java
This commit is contained in:
parent
2518a07d93
commit
c8e54a21c0
|
@ -21,27 +21,34 @@ public class UserNotNullUnitTest {
|
|||
@Test
|
||||
public void whenNotNullName_thenNoConstraintViolations() {
|
||||
UserNotNull user = new UserNotNull("John");
|
||||
|
||||
Set<ConstraintViolation<UserNotNull>> violations = validator.validate(user);
|
||||
|
||||
assertThat(violations.size()).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenNullName_thenOneConstraintViolation() {
|
||||
UserNotNull user = new UserNotNull(null);
|
||||
|
||||
Set<ConstraintViolation<UserNotNull>> violations = validator.validate(user);
|
||||
|
||||
assertThat(violations.size()).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenEmptyName_thenNoConstraintViolations() {
|
||||
UserNotNull user = new UserNotNull("");
|
||||
|
||||
Set<ConstraintViolation<UserNotNull>> violations = validator.validate(user);
|
||||
|
||||
assertThat(violations.size()).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenToString_thenCorrect() {
|
||||
UserNotNull user = new UserNotNull("John");
|
||||
|
||||
assertThat(user.toString()).isEqualTo("User{name=John}");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue