### Question:
UserServiceImpl implements UserService { @Override @Transactional(readOnly = true) public UserDto getUser(String email) { return userDtoMapper.map( userRepository.findOne(email).orElse(null) ); } UserServiceImpl(UserRepository userRepository, UserDtoMapper userDtoMapper); @Override @Transactional(readOnly = true) UserDto getUser(String email); @Override @Transactional @Cacheable("loginUserData") @Deprecated UserAuthentication login(UserLoginCommand loginCommand);  }### Answer:
@Test public void getUser() throws Exception { User user = UserMother.davy(); UserDto userDto = UserDtoMother.davy(); when(userRepository.findOne(user.getEmail())).thenReturn(Optional.of(user)); when(userDtoMapper.map(user)).thenReturn(userDto); UserDto result = userService.getUser(user.getEmail()); assertThat(result).isEqualToComparingFieldByField(userDto); }