@Test
public void testUpdateAdministrator_when_username_matches_but_password_is_wrong() {

	final String username = "TheUsername";
	AuthenticatedUser authenticatedUser = mock(AuthenticatedUser.class);
	when(authenticatedUser.getUsername()).thenReturn(username);
	when(userContext.getCurrentUser()).thenReturn(authenticatedUser);
	Users user = mock(Users.class);
	when(user.getUsername()).thenReturn(username);
	when(user.getPassword()).thenReturn("hashedpassword");
	when(usersRepository.loadUserByUsername(anyString())).thenReturn(user);
	when(passwordEncoder.matches("rawpassword", "hashedpassword"))
			.thenReturn(false);
	// Arrange
	AdminProfileDto adminProfileDtoInput = mock(AdminProfileDto.class);
	Staff admin = mock(Staff.class);
	when(adminProfileDtoInput.getUsername()).thenReturn(username);
	when(adminProfileDtoInput.getPassword()).thenReturn("rawpassword");
	when(adminProfileDtoInput.getFirstName()).thenReturn("albert");
	when(adminProfileDtoInput.getLastName()).thenReturn("Smith");
	when(adminProfileDtoInput.getEmail()).thenReturn(
			"albert.smith@consent2share.com");
	when(adminProfileDtoToAdministratorMapper.map(adminProfileDtoInput))
			.thenReturn(admin);
	// Act
	try {
		sut.updateAdministrator(adminProfileDtoInput);
	} catch (AuthenticationFailedException e) {
		assertEquals(e.getMessage(), "Password is incorrect.");
	}
	// Assert
	verify(administratorRepository, times(0)).save(admin);
}