source: class AuthenticatorTest {
  
      private static final String A_VALID_USER;
      private static final String AN_INVALID_USER;
      private static final String A_VALID_PASSWORD;
      private static final String AN_INVALID_PASSWORD;
      private static final long A_USER_ID;
      @Inject Authenticator authenticator;
      @Inject UserDao userDao;
      @Inject PasswordSecurity passwordSecurity;
      @Inject HttpSession httpSession;
      @Inject CurrentUserDtoProvider currentUserDtoProvider;
  
      @Test(expected = AuthenticationException.class)
      public void anInvalidUserShouldntBeAbleToConnect() {
  
target:         // Given
          given(userDao.findByUsername(AN_INVALID_USER)).willThrow(new NoResultException());
  
          // When
          authenticator.authenticateCredentials(AN_INVALID_USER, AN_INVALID_PASSWORD);
  
          // Then
          verify(httpSession, never()).setAttribute(anyString(), any());
      }
  
  }