Browse Source

account should be invalid for disabled user

feature-pr-AccountService
Sona Markosyan 3 years ago
parent
commit
ed3a1b7252
  1. 9
      src/test/java/hs/fulda/de/ci/exam/project/AccountServiceTest.java

9
src/test/java/hs/fulda/de/ci/exam/project/AccountServiceTest.java

@ -59,6 +59,15 @@ public class AccountServiceTest {
inOrder.verify(passwordEncoder, never()).encode(anyString()); 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() { private AccountRepository createAccountRepository() {
AccountRepository mock = mock(AccountRepository.class); AccountRepository mock = mock(AccountRepository.class);
when(mock.findById(ENABLED_USER.getId())).thenReturn(ENABLED_USER); when(mock.findById(ENABLED_USER.getId())).thenReturn(ENABLED_USER);

Loading…
Cancel
Save