Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Test
- public void itShouldNotRevokeSecondAccountAfterTwoFailedAttemptsFirstAccount()
- {
- this.willPasswordMatch(false);
- IAccount secondAccount = mock(IAccount.class);
- when(secondAccount.passwordMatches(anyString())).thenReturn(false);
- when(this.repository.find(anyString())).thenReturn(secondAccount);
- /*Wird benötigt da ansonsten immer "secondAccount" geliefert wird und
- damit dieser auf "Revoked" gesetzt wird. Mit diesem Befehl wird bei
- Eingabe von "schuchert" der erste Accont geliefert.
- */
- when(this.repository.find("brett")).thenReturn(account);
- when(secondAccount.getId()).thenReturn("asdf");
- service.login("brett", "password");
- service.login("brett", "password");
- service.login("schuchert", "password");
- verify(secondAccount, never()).setLoggedIn(true);
- verify (secondAccount, never()).setRevoked(true);
- verify (account,never()).setRevoked(true);
- }
Advertisement
Add Comment
Please, Sign In to add comment