@Test()
public void testLoadUserByUsername_when_account_is_lockout_verify_that_account_is_unlocked_after_5_minutes() {

	Users user = mock(Users.class);
	Calendar cal = Calendar.getInstance();
	cal.setTimeInMillis(Calendar.getInstance().getTimeInMillis() - 300000);
	when(usersRepository.loadUserByUsername(username)).thenReturn(user);
	when(user.getFailedLoginAttempts()).thenReturn(5);
	when(user.getLockoutTime()).thenReturn(cal);
	assertEquals(accountUserDetailsService.loadUserByUsername(username),
			user);
	verify(user).setLockoutTime(null);
	verify(user).setFailedLoginAttemptsToZero();
	verify(user).setAccountNonLocked(true);
	verify(usersRepository).updateUser(any(Users.class));
}