AccountServiceImpl implements AccountService { @Override public Users findUserByUsername(String username) { Users user = null; try { user = usersRepository.loadUserByUsername(username); } catch (UsernameNotFoundException e) { String message = String.format("Username %s is not found.", username); logger.info(message); } return user; } AccountServiceImpl(
			Integer accountVerificationTokenExpireInHours,
			PatientRepository patientRepository,
			AdministrativeGenderCodeRepository administrativeGenderCodeRepository,
			PasswordEncoder passwordEncoder, UserContext userContext,
			EmailSender emailSender, TokenGenerator tokenGenerator,
			EmailTokenRepository emailTokenRepository,
			UsersRepository usersRepository, MrnService mrnService,
			PixService pixService); @Override @Transactional void signup(SignupDto signupDto, String linkUrl); @Override String createEmailToken(String username, String emailAddress); @Override Users findUserByUsername(String username); @Override String recoverUsername(String firstName, String lastName,
			String birthDay, String email);  }
@Test public void testFindByUserName() { Users user = mock(Users.class); when(usersRepository.loadUserByUsername(anyString())).thenReturn(user); sut.findUserByUsername("username"); }