diff --git a/sign-in/spring-mvc-normal/src/test/java/net/petrikainulainen/spring/social/signinmvc/user/model/UserAssert.java b/sign-in/spring-mvc-normal/src/test/java/net/petrikainulainen/spring/social/signinmvc/user/model/UserAssert.java index 7f75e12..2466b38 100644 --- a/sign-in/spring-mvc-normal/src/test/java/net/petrikainulainen/spring/social/signinmvc/user/model/UserAssert.java +++ b/sign-in/spring-mvc-normal/src/test/java/net/petrikainulainen/spring/social/signinmvc/user/model/UserAssert.java @@ -67,18 +67,6 @@ public UserAssert hasNoId() { return this; } - public UserAssert hasNoPassword() { - isNotNull(); - - Assertions.assertThat(actual.getPassword()) - .overridingErrorMessage("Expected password to be but was <%s>", - actual.getPassword() - ) - .isNull(); - - return this; - } - public UserAssert hasPassword(String password) { isNotNull(); @@ -115,9 +103,21 @@ public UserAssert isRegisteredByUsingSignInProvider(SocialMediaService signInPro ) .isEqualTo(signInProvider); + hasNoPassword(); + return this; } + private void hasNoPassword() { + isNotNull(); + + Assertions.assertThat(actual.getPassword()) + .overridingErrorMessage("Expected password to be but was <%s>", + actual.getPassword() + ) + .isNull(); + } + public UserAssert isRegisteredUser() { isNotNull(); diff --git a/sign-in/spring-mvc-normal/src/test/java/net/petrikainulainen/spring/social/signinmvc/user/model/UserTest.java b/sign-in/spring-mvc-normal/src/test/java/net/petrikainulainen/spring/social/signinmvc/user/model/UserTest.java index 47424da..9ff6712 100644 --- a/sign-in/spring-mvc-normal/src/test/java/net/petrikainulainen/spring/social/signinmvc/user/model/UserTest.java +++ b/sign-in/spring-mvc-normal/src/test/java/net/petrikainulainen/spring/social/signinmvc/user/model/UserTest.java @@ -30,8 +30,7 @@ public void build_SignedInByUsingSocialMediaService_ShouldCreateUser() { .hasFirstName(FIRST_NAME) .hasLastName(LAST_NAME) .isRegisteredUser() - .isRegisteredByUsingSignInProvider(SIGN_IN_PROVIDER) - .hasNoPassword(); + .isRegisteredByUsingSignInProvider(SIGN_IN_PROVIDER); } @Test diff --git a/sign-in/spring-mvc-normal/src/test/java/net/petrikainulainen/spring/social/signinmvc/user/service/RepositoryUserServiceTest.java b/sign-in/spring-mvc-normal/src/test/java/net/petrikainulainen/spring/social/signinmvc/user/service/RepositoryUserServiceTest.java index 829ea9f..698ec12 100644 --- a/sign-in/spring-mvc-normal/src/test/java/net/petrikainulainen/spring/social/signinmvc/user/service/RepositoryUserServiceTest.java +++ b/sign-in/spring-mvc-normal/src/test/java/net/petrikainulainen/spring/social/signinmvc/user/service/RepositoryUserServiceTest.java @@ -75,7 +75,6 @@ public User answer(InvocationOnMock invocation) throws Throwable { .hasEmail(EMAIL) .hasFirstName(FIRST_NAME) .hasLastName(LAST_NAME) - .hasNoPassword() .isRegisteredUser() .isRegisteredByUsingSignInProvider(SIGN_IN_PROVIDER);