From 81b34c7628273b45e3966c11e64528dd6899409d Mon Sep 17 00:00:00 2001 From: Alejandro Gervasio Date: Tue, 25 Sep 2018 01:22:37 -0300 Subject: [PATCH] Update UserNotBlankUnitTest.java --- .../javabeanconstraints/test/UserNotBlankUnitTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotBlankUnitTest.java b/javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotBlankUnitTest.java index 081ceadfbe..954833fef1 100644 --- a/javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotBlankUnitTest.java +++ b/javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotBlankUnitTest.java @@ -21,34 +21,43 @@ public class UserNotBlankUnitTest { @Test public void whenNotBlankName_thenNoConstraintViolations() { UserNotBlank user = new UserNotBlank("John"); + Set> violations = validator.validate(user); + assertThat(violations.size()).isEqualTo(0); } @Test public void whenBlankName_thenOneConstraintViolation() { UserNotBlank user = new UserNotBlank(" "); + Set> violations = validator.validate(user); + assertThat(violations.size()).isEqualTo(1); } @Test public void whenEmptyName_thenOneConstraintViolation() { UserNotBlank user = new UserNotBlank(""); + Set> violations = validator.validate(user); + assertThat(violations.size()).isEqualTo(1); } @Test public void whenNullName_thenOneConstraintViolation() { UserNotBlank user = new UserNotBlank(null); + Set> violations = validator.validate(user); + assertThat(violations.size()).isEqualTo(1); } @Test public void whenToString_thenCorrect() { UserNotBlank user = new UserNotBlank("John"); + assertThat(user.toString()).isEqualTo("User{name=John}"); } }