@Test public void testDeleteOrganizationalProviderDto() { OrganizationalProviderDto organizationalProviderDto = mock(OrganizationalProviderDto.class); organizationalProviderService .deleteOrganizationalProviderDto(mock(OrganizationalProviderDto.class)); verify(patientRepository).save(any(Patient.class)); }
@Override public void deleteOrganizationalProviderDto( OrganizationalProviderDto organizationalProviderDto) { Patient patient = patientRepository .findByUsername(organizationalProviderDto.getUsername()); Set<OrganizationalProvider> organizationalProviders = patient .getOrganizationalProviders(); for (OrganizationalProvider o : organizationalProviders) { if (o.getNpi().equals(organizationalProviderDto.getNpi())) { organizationalProviders.remove(o); break; } } patient.setOrganizationalProviders(organizationalProviders); patientRepository.save(patient); }
OrganizationalProviderServiceImpl implements
		OrganizationalProviderService { @Override public void deleteOrganizationalProviderDto( OrganizationalProviderDto organizationalProviderDto) { Patient patient = patientRepository .findByUsername(organizationalProviderDto.getUsername()); Set<OrganizationalProvider> organizationalProviders = patient .getOrganizationalProviders(); for (OrganizationalProvider o : organizationalProviders) { if (o.getNpi().equals(organizationalProviderDto.getNpi())) { organizationalProviders.remove(o); break; } } patient.setOrganizationalProviders(organizationalProviders); patientRepository.save(patient); } }
OrganizationalProviderServiceImpl implements
		OrganizationalProviderService { @Override public void deleteOrganizationalProviderDto( OrganizationalProviderDto organizationalProviderDto) { Patient patient = patientRepository .findByUsername(organizationalProviderDto.getUsername()); Set<OrganizationalProvider> organizationalProviders = patient .getOrganizationalProviders(); for (OrganizationalProvider o : organizationalProviders) { if (o.getNpi().equals(organizationalProviderDto.getNpi())) { organizationalProviders.remove(o); break; } } patient.setOrganizationalProviders(organizationalProviders); patientRepository.save(patient); } OrganizationalProviderServiceImpl(
			PatientRepository patientRepository, ModelMapper modelMapper,
			OrganizationalProviderRepository organizationalProviderRepository); }
OrganizationalProviderServiceImpl implements
		OrganizationalProviderService { @Override public void deleteOrganizationalProviderDto( OrganizationalProviderDto organizationalProviderDto) { Patient patient = patientRepository .findByUsername(organizationalProviderDto.getUsername()); Set<OrganizationalProvider> organizationalProviders = patient .getOrganizationalProviders(); for (OrganizationalProvider o : organizationalProviders) { if (o.getNpi().equals(organizationalProviderDto.getNpi())) { organizationalProviders.remove(o); break; } } patient.setOrganizationalProviders(organizationalProviders); patientRepository.save(patient); } OrganizationalProviderServiceImpl(
			PatientRepository patientRepository, ModelMapper modelMapper,
			OrganizationalProviderRepository organizationalProviderRepository); @Override long countAllOrganizationalProviders(); @Override void deleteOrganizationalProvider(
			OrganizationalProvider organizationalProvider); @Override void deleteOrganizationalProviderDto(
			OrganizationalProviderDto organizationalProviderDto); @Override void deleteOrganizationalProviderDtoByPatientId(
			OrganizationalProviderDto organizationalProviderDto); @Override OrganizationalProvider findOrganizationalProvider(Long id); @Override OrganizationalProviderDto findOrganizationalProviderDto(Long id); @Override List<OrganizationalProvider> findAllOrganizationalProviders(); @Override List<OrganizationalProvider> findOrganizationalProviderEntries(
			int firstResult, int maxResults); @Override void saveOrganizationalProvider(
			OrganizationalProvider organizationalProvider); @Override OrganizationalProvider updateOrganizationalProvider(
			OrganizationalProvider organizationalProvider); @Override void updateOrganizationalProvider(
			OrganizationalProviderDto organizationalProviderDto); @Override OrganizationalProvider addNewOrganizationalProvider(
			OrganizationalProviderDto organizationalProviderDto); OrganizationalProvider findOrganizationalProviderByNpi(String npi); }
OrganizationalProviderServiceImpl implements
		OrganizationalProviderService { @Override public void deleteOrganizationalProviderDto( OrganizationalProviderDto organizationalProviderDto) { Patient patient = patientRepository .findByUsername(organizationalProviderDto.getUsername()); Set<OrganizationalProvider> organizationalProviders = patient .getOrganizationalProviders(); for (OrganizationalProvider o : organizationalProviders) { if (o.getNpi().equals(organizationalProviderDto.getNpi())) { organizationalProviders.remove(o); break; } } patient.setOrganizationalProviders(organizationalProviders); patientRepository.save(patient); } OrganizationalProviderServiceImpl(
			PatientRepository patientRepository, ModelMapper modelMapper,
			OrganizationalProviderRepository organizationalProviderRepository); @Override long countAllOrganizationalProviders(); @Override void deleteOrganizationalProvider(
			OrganizationalProvider organizationalProvider); @Override void deleteOrganizationalProviderDto(
			OrganizationalProviderDto organizationalProviderDto); @Override void deleteOrganizationalProviderDtoByPatientId(
			OrganizationalProviderDto organizationalProviderDto); @Override OrganizationalProvider findOrganizationalProvider(Long id); @Override OrganizationalProviderDto findOrganizationalProviderDto(Long id); @Override List<OrganizationalProvider> findAllOrganizationalProviders(); @Override List<OrganizationalProvider> findOrganizationalProviderEntries(
			int firstResult, int maxResults); @Override void saveOrganizationalProvider(
			OrganizationalProvider organizationalProvider); @Override OrganizationalProvider updateOrganizationalProvider(
			OrganizationalProvider organizationalProvider); @Override void updateOrganizationalProvider(
			OrganizationalProviderDto organizationalProviderDto); @Override OrganizationalProvider addNewOrganizationalProvider(
			OrganizationalProviderDto organizationalProviderDto); OrganizationalProvider findOrganizationalProviderByNpi(String npi);  }