@Test public void testSavePatient() { PatientProfileDto patientProfileDtoInput = mock(PatientProfileDto.class); Patient patient = mock(Patient.class); when(patientProfileDtoToPatientMapper.map(patientProfileDtoInput)) .thenReturn(patient); PatientProfileDto expectedPatientProfileDto = mock(PatientProfileDto.class); when(modelMapper.map(patient, PatientProfileDto.class)).thenReturn( expectedPatientProfileDto); PatientProfileDto result = sut.savePatient(patientProfileDtoInput); verify(patientRepository, times(1)).save(patient); assertEquals(expectedPatientProfileDto, result); }
@Override @Transactional public PatientProfileDto savePatient(PatientProfileDto patientDto) { Patient patient = patientProfileDtoToPatientMapper.map(patientDto); patientRepository.save(patient); PatientProfileDto patientProfileDto = modelMapper.map(patient, PatientProfileDto.class); return patientProfileDto; }
PatientServiceImpl implements PatientService { @Override @Transactional public PatientProfileDto savePatient(PatientProfileDto patientDto) { Patient patient = patientProfileDtoToPatientMapper.map(patientDto); patientRepository.save(patient); PatientProfileDto patientProfileDto = modelMapper.map(patient, PatientProfileDto.class); return patientProfileDto; } }
PatientServiceImpl implements PatientService { @Override @Transactional public PatientProfileDto savePatient(PatientProfileDto patientDto) { Patient patient = patientProfileDtoToPatientMapper.map(patientDto); patientRepository.save(patient); PatientProfileDto patientProfileDto = modelMapper.map(patient, PatientProfileDto.class); return patientProfileDto; } PatientServiceImpl(
			PatientRepository patientRepository,
			PatientLegalRepresentativeAssociationRepository patientLegalRepresentativeAssociationRepository,
			ModelMapper modelMapper,
			UserContext userContext,
			DtoToDomainEntityMapper<PatientProfileDto, Patient> patientProfileDtoToPatientMapper,
			UsersRepository usersRepository, PasswordEncoder passwordEncoder,
			EmailSender emailSender, PixService pixService); }
PatientServiceImpl implements PatientService { @Override @Transactional public PatientProfileDto savePatient(PatientProfileDto patientDto) { Patient patient = patientProfileDtoToPatientMapper.map(patientDto); patientRepository.save(patient); PatientProfileDto patientProfileDto = modelMapper.map(patient, PatientProfileDto.class); return patientProfileDto; } PatientServiceImpl(
			PatientRepository patientRepository,
			PatientLegalRepresentativeAssociationRepository patientLegalRepresentativeAssociationRepository,
			ModelMapper modelMapper,
			UserContext userContext,
			DtoToDomainEntityMapper<PatientProfileDto, Patient> patientProfileDtoToPatientMapper,
			UsersRepository usersRepository, PasswordEncoder passwordEncoder,
			EmailSender emailSender, PixService pixService); @Override long countAllPatients(); @Override PatientProfileDto findPatient(Long id); @Override List<PatientAdminDto> findAllPatientByFirstNameAndLastName(
			String[] tokens); @Override PatientProfileDto findByUsername(String username); @Override Long findIdByUsername(String username); @Override String findUsernameById(long id); @Override String findPatientEmailByUsername(String username); @Override PatientProfileDto findPatientProfileByUsername(String username); @Override PatientConnectionDto findPatientConnectionByUsername(String username); @Override PatientConnectionDto findPatientConnectionByPatient(Patient patient); @Override PatientConnectionDto findPatientConnectionById(long id); @Override List<PatientProfileDto> findPatientEntries(int pageNumber,
			int pageSize); @Override @Transactional PatientProfileDto savePatient(PatientProfileDto patientDto); @Override @Transactional void updatePatient(PatientProfileDto patientDto); @Override @Transactional void updateEid(String username); @Override @Transactional void updateEid(long id); @Override List<AddConsentIndividualProviderDto> findAddConsentIndividualProviderDtoByUsername(
			String username); @Override List<AddConsentOrganizationalProviderDto> findAddConsentOrganizationalProviderDtoByPatientId(
			long pateintId); @Override List<AddConsentIndividualProviderDto> findAddConsentIndividualProviderDtoByPatientId(
			long pateintId); @Override List<AddConsentOrganizationalProviderDto> findAddConsentOrganizationalProviderDtoByUsername(
			String username); @Override boolean isLegalRepForCurrentUser(Long legalRepId); @Override List<RecentPatientDto> findRecentPatientDtosById(List<String> ids); }
PatientServiceImpl implements PatientService { @Override @Transactional public PatientProfileDto savePatient(PatientProfileDto patientDto) { Patient patient = patientProfileDtoToPatientMapper.map(patientDto); patientRepository.save(patient); PatientProfileDto patientProfileDto = modelMapper.map(patient, PatientProfileDto.class); return patientProfileDto; } PatientServiceImpl(
			PatientRepository patientRepository,
			PatientLegalRepresentativeAssociationRepository patientLegalRepresentativeAssociationRepository,
			ModelMapper modelMapper,
			UserContext userContext,
			DtoToDomainEntityMapper<PatientProfileDto, Patient> patientProfileDtoToPatientMapper,
			UsersRepository usersRepository, PasswordEncoder passwordEncoder,
			EmailSender emailSender, PixService pixService); @Override long countAllPatients(); @Override PatientProfileDto findPatient(Long id); @Override List<PatientAdminDto> findAllPatientByFirstNameAndLastName(
			String[] tokens); @Override PatientProfileDto findByUsername(String username); @Override Long findIdByUsername(String username); @Override String findUsernameById(long id); @Override String findPatientEmailByUsername(String username); @Override PatientProfileDto findPatientProfileByUsername(String username); @Override PatientConnectionDto findPatientConnectionByUsername(String username); @Override PatientConnectionDto findPatientConnectionByPatient(Patient patient); @Override PatientConnectionDto findPatientConnectionById(long id); @Override List<PatientProfileDto> findPatientEntries(int pageNumber,
			int pageSize); @Override @Transactional PatientProfileDto savePatient(PatientProfileDto patientDto); @Override @Transactional void updatePatient(PatientProfileDto patientDto); @Override @Transactional void updateEid(String username); @Override @Transactional void updateEid(long id); @Override List<AddConsentIndividualProviderDto> findAddConsentIndividualProviderDtoByUsername(
			String username); @Override List<AddConsentOrganizationalProviderDto> findAddConsentOrganizationalProviderDtoByPatientId(
			long pateintId); @Override List<AddConsentIndividualProviderDto> findAddConsentIndividualProviderDtoByPatientId(
			long pateintId); @Override List<AddConsentOrganizationalProviderDto> findAddConsentOrganizationalProviderDtoByUsername(
			String username); @Override boolean isLegalRepForCurrentUser(Long legalRepId); @Override List<RecentPatientDto> findRecentPatientDtosById(List<String> ids); static final Integer LAST_N_DIGITS_OF_SSN; }