@Test public void getUserByEmailIdUserNotFoundTest() throws PacManException { when(userRepository.findByEmailIgnoreCase(anyString())).thenReturn(null); assertThat(userService.getUserByEmailId(anyString()).getEmail(), is("")); }
@Override public UserDetails getUserByEmailId(final String emailId) throws PacManException { User user; if (emailId != null) { user = userRepository.findByEmailIgnoreCase(emailId); return fetchUserDetails(user, emailId); } else { throw new PacManException("Email Id cannot be empty"); } }
UserServiceImpl implements UserService { @Override public UserDetails getUserByEmailId(final String emailId) throws PacManException { User user; if (emailId != null) { user = userRepository.findByEmailIgnoreCase(emailId); return fetchUserDetails(user, emailId); } else { throw new PacManException("Email Id cannot be empty"); } } }
UserServiceImpl implements UserService { @Override public UserDetails getUserByEmailId(final String emailId) throws PacManException { User user; if (emailId != null) { user = userRepository.findByEmailIgnoreCase(emailId); return fetchUserDetails(user, emailId); } else { throw new PacManException("Email Id cannot be empty"); } }  }
UserServiceImpl implements UserService { @Override public UserDetails getUserByEmailId(final String emailId) throws PacManException { User user; if (emailId != null) { user = userRepository.findByEmailIgnoreCase(emailId); return fetchUserDetails(user, emailId); } else { throw new PacManException("Email Id cannot be empty"); } }  @Override List<User> getAllLoginUsers(); @Override UserDetails getUserByEmailId(final String emailId); }
UserServiceImpl implements UserService { @Override public UserDetails getUserByEmailId(final String emailId) throws PacManException { User user; if (emailId != null) { user = userRepository.findByEmailIgnoreCase(emailId); return fetchUserDetails(user, emailId); } else { throw new PacManException("Email Id cannot be empty"); } }  @Override List<User> getAllLoginUsers(); @Override UserDetails getUserByEmailId(final String emailId);  }