@Test
public void testPasswordMatch() {

    Mockito.when(mockUserService.containsName(USERNAME)).thenReturn(true);
    Mockito.when(mockAuthenticationService.userPasswordCheck(USERNAME, PASSWORD)).thenReturn(true);
    Mockito.when(mockUserEntity.getId()).thenReturn(UUID.randomUUID());
    Mockito.when(mockUserEntity.getName()).thenReturn(USERNAME);
    Mockito.when(mockAuthenticationService.authenticationToken(USERNAME, PASSWORD)).thenReturn("");
    Mockito.when(mockUserService.findByName(USERNAME)).thenReturn(mockUserEntity);
    final LoginRequest loginRequest = new LoginRequest();
    loginRequest.setName(USERNAME);
    loginRequest.setPassword(PASSWORD);
    boolean exceptionThrown = false;
    try {
        userController.login(loginRequest);
    } catch (final InvalidLoginException e) {
        exceptionThrown = true;
    }
    assertFalse(exceptionThrown);
    Mockito.verify(mockUserService).containsName(USERNAME);
    Mockito.verify(mockAuthenticationService).userPasswordCheck(USERNAME, PASSWORD);
    Mockito.verify(mockAuthenticationService).authenticationToken(USERNAME, PASSWORD);
    Mockito.verify(mockUserEntity).getId();
    Mockito.verify(mockUserEntity).getName();
    Mockito.verify(mockUserService).findByName(USERNAME);
}