@Test
public void aValidUserShouldBeAbleToConnect() {

    // Given
    User user = mock(User.class);
    given(user.getId()).willReturn(A_USER_ID);
    given(userDao.findByUsername(A_VALID_USER)).willReturn(user);
    given(passwordSecurity.check(anyString(), anyString())).willReturn(true);
    // When
    UserDto fetchUser = authenticator.authenticateCredentials(A_VALID_USER, A_VALID_PASSWORD);
    // Then
    assertNotNull(fetchUser);
    verify(httpSession).setAttribute(SecurityParameters.getUserSessionKey(), A_USER_ID);
}