@Test public void testFindOneByUsernameOrEmail_username() { User user = userService.findOneByUsernameOrEmail("admin"); assertThat(user, is(notNullValue())); }
@Override public User findOneByUsernameOrEmail(String usernameOrEmail) { User user = userRepository.findOneByEmail(usernameOrEmail); if (user == null) { user = userRepository.findDetails(usernameOrEmail); } if (user == null) { ResultMessages messages = ResultMessages.error() .add(MessageKeys.E_CT_US_8102, usernameOrEmail); throw new ResourceNotFoundException(messages); } return user; }
UserServiceImpl implements UserService { @Override public User findOneByUsernameOrEmail(String usernameOrEmail) { User user = userRepository.findOneByEmail(usernameOrEmail); if (user == null) { user = userRepository.findDetails(usernameOrEmail); } if (user == null) { ResultMessages messages = ResultMessages.error() .add(MessageKeys.E_CT_US_8102, usernameOrEmail); throw new ResourceNotFoundException(messages); } return user; } }
UserServiceImpl implements UserService { @Override public User findOneByUsernameOrEmail(String usernameOrEmail) { User user = userRepository.findOneByEmail(usernameOrEmail); if (user == null) { user = userRepository.findDetails(usernameOrEmail); } if (user == null) { ResultMessages messages = ResultMessages.error() .add(MessageKeys.E_CT_US_8102, usernameOrEmail); throw new ResourceNotFoundException(messages); } return user; }  }
UserServiceImpl implements UserService { @Override public User findOneByUsernameOrEmail(String usernameOrEmail) { User user = userRepository.findOneByEmail(usernameOrEmail); if (user == null) { user = userRepository.findDetails(usernameOrEmail); } if (user == null) { ResultMessages messages = ResultMessages.error() .add(MessageKeys.E_CT_US_8102, usernameOrEmail); throw new ResourceNotFoundException(messages); } return user; }  @Override User findOne(String username); @Override User findOneByUsernameOrEmail(String usernameOrEmail); @Override Page<User> findPage(Pageable pageable); @Transactional @Override User create(User user, String rawPassword); @Transactional @Override User update(String username, User updatedUser,
                       String updatedRawPassword); @Transactional @Override User updateWithoutPassword(String username, User updatedUser); @Transactional @Override void delete(String username); }
UserServiceImpl implements UserService { @Override public User findOneByUsernameOrEmail(String usernameOrEmail) { User user = userRepository.findOneByEmail(usernameOrEmail); if (user == null) { user = userRepository.findDetails(usernameOrEmail); } if (user == null) { ResultMessages messages = ResultMessages.error() .add(MessageKeys.E_CT_US_8102, usernameOrEmail); throw new ResourceNotFoundException(messages); } return user; }  @Override User findOne(String username); @Override User findOneByUsernameOrEmail(String usernameOrEmail); @Override Page<User> findPage(Pageable pageable); @Transactional @Override User create(User user, String rawPassword); @Transactional @Override User update(String username, User updatedUser,
                       String updatedRawPassword); @Transactional @Override User updateWithoutPassword(String username, User updatedUser); @Transactional @Override void delete(String username);  }