@Test
public void attemptAuthentication_test_with_username_password() {

    mockHttpServletRequest.setMethod("POST");
    mockHttpServletRequest.setParameter("username", "username");
    mockHttpServletRequest.setParameter("password", "password");
    when(authenticationManager.authenticate(captor.capture())).thenReturn(null);
    target.attemptAuthentication(mockHttpServletRequest, mockHttpServletResponse);
    Authentication authenticationToken = captor.getValue();
    assertThat(authenticationToken.getPrincipal()).isEqualTo("username");
    assertThat(authenticationToken.getCredentials()).isEqualTo("password");
}