@Test public void getUserByEmailIdEmailIdNotFoundTest() throws PacManException { User user = getUserDetails(); when(userRepository.findByEmailIgnoreCase(anyString())).thenReturn(user); assertThatThrownBy(() -> userService.getUserByEmailId(null)).isInstanceOf(PacManException.class); }
@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);  }