IndividualProviderServiceImpl implements IndividualProviderService { @Override public void deleteIndividualProviderDto( IndividualProviderDto individualProviderDto) { Patient patient = patientRepository .findByUsername(individualProviderDto.getUsername()); Set<IndividualProvider> individualProviders = patient .getIndividualProviders(); for (IndividualProvider o : individualProviders) { if (o.getNpi().equals(individualProviderDto.getNpi())) { individualProviders.remove(o); break; } } patient.setIndividualProviders(individualProviders); patientRepository.save(patient); } IndividualProviderServiceImpl(
			IndividualProviderRepository individualProviderRepository,
			ModelMapper modelMapper, PatientRepository patientRepository); @Override long countAllIndividualProviders(); @Override void updateIndividualProvider(
			IndividualProviderDto individualProviderDto); @Override void deleteIndividualProvider(IndividualProvider individualProvider); @Override void deleteIndividualProviderDto(
			IndividualProviderDto individualProviderDto); @Override void deleteIndividualProviderDtoByPatientId(
			IndividualProviderDto individualProviderDto); @Override IndividualProvider findIndividualProviderByNpi(String npi); @Override IndividualProvider findIndividualProvider(Long id); @Override List<IndividualProvider> findAllIndividualProviders(); @Override List<IndividualProvider> findIndividualProviderEntries(
			int firstResult, int maxResults); @Override void saveIndividualProvider(IndividualProvider individualProvider); @Override IndividualProvider updateIndividualProvider(
			IndividualProvider individualProvider); @Override IndividualProvider addNewIndividualProvider(
			IndividualProviderDto individualProviderDto); @Override List<IndividualProviderDto> findAllIndividualProvidersDto(); @Override IndividualProviderDto findIndividualProviderDto(Long id);  }
@Test public void testDeleteIndividualProviderDto() { IndividualProviderDto individualProviderDto = mock(IndividualProviderDto.class); individualProviderService .deleteIndividualProviderDto(mock(IndividualProviderDto.class)); verify(patientRepository).save(any(Patient.class)); }
@Test public void testDeleteIndividualProviderByPatientId() { IndividualProviderDto individualProviderDto = mock(IndividualProviderDto.class); when(individualProviderDto.getPatientId()).thenReturn("11"); Patient patient = mock(Patient.class); when(patientRepository.findOne(anyLong())).thenReturn(patient); individualProviderService .deleteIndividualProviderDto(individualProviderDto); verify(patientRepository).save(any(Patient.class)); }