@Test
public void testDeletePatientLegalRepresentativeAssociationById() {

	List<PatientLegalRepresentativeAssociation> associations = new ArrayList<PatientLegalRepresentativeAssociation>();
	PatientLegalRepresentativeAssociation association = mock(PatientLegalRepresentativeAssociation.class);
	PatientLegalRepresentativeAssociationPk associationPk = mock(PatientLegalRepresentativeAssociationPk.class);
	when(association.getPatientLegalRepresentativeAssociationPk())
			.thenReturn(associationPk);
	associations.add(association);
	Patient patient = mock(Patient.class);
	when(associationPk.getPatient()).thenReturn(patient);
	when(patient.getId()).thenReturn((long) 1);
	Patient patient2 = mock(Patient.class);
	when(
			patientLegalRepresentativeAssociationRepository
					.findByPatientLegalRepresentativeAssociationPkLegalRepresentativeId(anyLong()))
			.thenReturn(associations);
	when(patientRepository.findByUsername(anyString()))
			.thenReturn(patient2);
	when(patient2.getId()).thenReturn((long) 1);
	patientLegalRepresentativeAssociationService
			.deletePatientLegalRepresentativeById(anyLong());
	verify(patientLegalRepresentativeAssociationRepository).delete(
			association);
}