From ed3a1b72525cd3fef74e9e104351da4230db08cd Mon Sep 17 00:00:00 2001 From: Sona Markosyan Date: Fri, 11 Feb 2022 01:18:07 +0100 Subject: [PATCH] account should be invalid for disabled user --- .../hs/fulda/de/ci/exam/project/AccountServiceTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/java/hs/fulda/de/ci/exam/project/AccountServiceTest.java b/src/test/java/hs/fulda/de/ci/exam/project/AccountServiceTest.java index b1c1681..90d1d69 100644 --- a/src/test/java/hs/fulda/de/ci/exam/project/AccountServiceTest.java +++ b/src/test/java/hs/fulda/de/ci/exam/project/AccountServiceTest.java @@ -59,6 +59,15 @@ public class AccountServiceTest { inOrder.verify(passwordEncoder, never()).encode(anyString()); } + @Test + public void shouldBeInvalidForDisabledUser(){ + boolean accountIsValid = + accountService.isValidAccount(DISABLED_USER.getId(), PASSWORD); + assertFalse(accountIsValid); + + verify(accountRepository).findById(DISABLED_USER.getId()); + verify(passwordEncoder, never()).encode(anyString()); + } private AccountRepository createAccountRepository() { AccountRepository mock = mock(AccountRepository.class); when(mock.findById(ENABLED_USER.getId())).thenReturn(ENABLED_USER);