### Question:
UserServiceImpl implements UserService { @Override public User createUser(UserForm userForm) { final CreateUserRequest request = new CreateUserRequest(); request.setToken(userForm.getEmail()); request.setFirstName(userForm.getFirstName()); request.setLastName(userForm.getLastName()); request.setEmail(userForm.getEmail()); request.setBirthDate(userForm.getBirthDate()); request.setSsn(userForm.getSsn()); final CreateUserResponse response = marqetaClient.createUser(request); final User user = new User(); user.setToken(response.getToken()); user.setFirstName(response.getFirstName()); user.setLastName(response.getLastName()); user.setEmail(response.getEmail()); user.setBirthDate(response.getBirthDate()); user.setSsn(response.getSsn()); return userRepository.save(user); } UserServiceImpl(MarqetaClient marqetaClient, UserRepository userRepository); @Override Optional<User> getUserByEmail(String email); @Override User createUser(UserForm userForm);  }### Answer:
@Test public void shouldCallMarqetaApiAndSaveResponse() { final UserForm userForm = new UserForm(); userForm.setFirstName("John"); userForm.setLastName("Doe"); userForm.setEmail(USER_EMAIL); userForm.setBirthDate(LocalDate.now().minusYears(25)); userForm.setSsn("111223333"); final CreateUserResponse response = new CreateUserResponse(); response.setToken(userForm.getEmail()); response.setFirstName(userForm.getFirstName()); response.setLastName(userForm.getLastName()); response.setEmail(userForm.getEmail()); response.setBirthDate(userForm.getBirthDate()); response.setSsn(userForm.getSsn()); when(marqetaClient.createUser(any())).thenReturn(response); final User entity = target.createUser(userForm); assertThat(entity, is(notNullValue())); assertThat(entity.getToken(), is(equalTo(response.getToken()))); assertThat(entity.getFirstName(), is(equalTo(response.getFirstName()))); assertThat(entity.getLastName(), is(equalTo(response.getLastName()))); assertThat(entity.getEmail(), is(equalTo(response.getEmail()))); assertThat(entity.getBirthDate(), is(equalTo(response.getBirthDate()))); assertThat(entity.getSsn(), is(equalTo(response.getSsn()))); final ArgumentCaptor<CreateUserRequest> arg = ArgumentCaptor.forClass(CreateUserRequest.class); verify(marqetaClient).createUser(arg.capture()); final CreateUserRequest request = arg.getValue(); assertThat(request, is(notNullValue())); assertThat(request.getToken(), is(userForm.getEmail())); assertThat(request.getFirstName(), is(equalTo(userForm.getFirstName()))); assertThat(request.getLastName(), is(equalTo(userForm.getLastName()))); assertThat(request.getEmail(), is(equalTo(userForm.getEmail()))); assertThat(request.getBirthDate(), is(equalTo(userForm.getBirthDate()))); assertThat(request.getSsn(), is(equalTo(userForm.getSsn()))); }