|
@ -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); |
|
|