PatientLegalRepresentativeAssociationServiceImpl implements
		PatientLegalRepresentativeAssociationService { @Override public void updatePatientLegalRepresentativeAssociationDto( PatientLegalRepresentativeAssociationDto patientLegalRepresentativeAssociationDto) { List<PatientLegalRepresentativeAssociation> associations = patientLegalRepresentativeAssociationRepository .findByPatientLegalRepresentativeAssociationPkLegalRepresentativeId(patientLegalRepresentativeAssociationDto .getLegalRepresentativeId()); for (PatientLegalRepresentativeAssociation association : associations) { if (patientRepository.findByUsername( userContext.getCurrentUser().getUsername()).getId() == association .getPatientLegalRepresentativeAssociationPk().getPatient() .getId()) { if (patientLegalRepresentativeAssociationDto .getLegalRepresentativeTypeCode() != null) { association .setLegalRepresentativeTypeCode(legalRepresentativeTypeCodeRepository .findByCode(patientLegalRepresentativeAssociationDto .getLegalRepresentativeTypeCode() .getCode())); } else { association.setLegalRepresentativeTypeCode(null); } if (patientLegalRepresentativeAssociationDto .getRelationshipStartDate() != null) { association .setRelationshipStartDate(patientLegalRepresentativeAssociationDto .getRelationshipStartDate()); } else { association.setRelationshipStartDate(null); } if (patientLegalRepresentativeAssociationDto .getRelationshipEndDate() != null) { association .setRelationshipEndDate(patientLegalRepresentativeAssociationDto .getRelationshipEndDate()); } else { association.setRelationshipEndDate(null); } patientLegalRepresentativeAssociationRepository .save(association); } } } PatientLegalRepresentativeAssociationServiceImpl(
			PatientLegalRepresentativeAssociationRepository patientLegalRepresentativeAssociationRepository,
			PatientRepository patientRepository,
			LegalRepresentativeTypeCodeRepository legalRepresentativeTypeCodeRepository,
			ModelMapper modelMapper, UserContext userContext); @Override long countAllPatientLegalRepresentativeAssociations(); @Override void deletePatientLegalRepresentativeAssociation(
			PatientLegalRepresentativeAssociation patientLegalRepresentativeAssociation); @Override void deletePatientLegalRepresentativeById(Long legalRepId); @Override PatientLegalRepresentativeAssociation findPatientLegalRepresentativeAssociation(
			Long id); @Override List<PatientLegalRepresentativeAssociation> findAllPatientLegalRepresentativeAssociations(); @Override List<PatientLegalRepresentativeAssociationDto> findAllPatientLegalRepresentativeAssociationDtos(); @Override List<PatientProfileDto> findAllPatientLegalRepresentativeDto(); @Override List<PatientLegalRepresentativeAssociation> findPatientLegalRepresentativeAssociationEntries(
			int firstResult, int maxResults); @Override void savePatientLegalRepresentativeAssociation(
			PatientLegalRepresentativeAssociation patientLegalRepresentativeAssociation); @Override void savePatientLegalRepresentativeAssociationDto(
			PatientLegalRepresentativeAssociationDto patientLegalRepresentativeAssociationDto); @Override PatientLegalRepresentativeAssociation updatePatientLegalRepresentativeAssociation(
			PatientLegalRepresentativeAssociation patientLegalRepresentativeAssociation); @Override void updatePatientLegalRepresentativeAssociationDto(
			PatientLegalRepresentativeAssociationDto patientLegalRepresentativeAssociationDto); @Override List<LegalRepresentativeDto> getAllLegalRepresentativeDto(); @Override PatientLegalRepresentativeAssociationDto getAssociationDtoFromLegalRepresentativeDto(
			LegalRepresentativeDto legalRepresentativeDto); @Override PatientProfileDto getPatientDtoFromLegalRepresentativeDto(
			LegalRepresentativeDto legalRepresentativeDto);  }
@Test public void testUpdatePatientLegalRepresentativeAssociationDto() { patientLegalRepresentativeAssociationService .updatePatientLegalRepresentativeAssociationDto(mock(PatientLegalRepresentativeAssociationDto.class)); verify(patientLegalRepresentativeAssociationRepository) .findByPatientLegalRepresentativeAssociationPkLegalRepresentativeId( anyLong()); }