### Question:
UserServiceImpl implements UserService { @Override public Optional<User> getUserByEmail(String email) { return userRepository.findByEmail(email); } UserServiceImpl(MarqetaClient marqetaClient, UserRepository userRepository); @Override Optional<User> getUserByEmail(String email); @Override User createUser(UserForm userForm);  }### Answer:
@Test public void shouldReturnUserByEmail() { final User entity = new User(); when(userRepository.findByEmail(any())).thenReturn(Optional.of(entity)); assertThat(target.getUserByEmail(USER_EMAIL), is(optionalWithValue(sameInstance(entity)))); verify(userRepository).findByEmail(USER_EMAIL); }