/** * Cannot distinguish between null and empty patient identifiers because you cannot set the * patient identifiers directly. There's only a method to add and remove patient identifiers. * * @see PatientService#checkPatientIdentifiers(Patient) */ @Test(expected = InsufficientIdentifiersException.class) public void checkPatientIdentifiers_shouldThrowErrorWhenPatientHasEmptyPatientIdentifiers() throws Exception { Patient patient = new Patient(); patient.setIdentifiers(new HashSet<>()); Context.getPatientService().checkPatientIdentifiers(patient); }
/** * @see Patient#addIdentifier(PatientIdentifier) */ @Test public void addIdentifier_shouldNotFailWithNullIdentifiersList() { Patient p = new Patient(); p.setIdentifiers(null); p.addIdentifier(new PatientIdentifier()); }
/** * @see Patient#getIdentifiers() */ @Test public void getIdentifiers_shouldNotReturnNull() { Patient p = new Patient(); p.setIdentifiers(null); Assert.assertNotNull(p.getIdentifiers()); }
/** * @see PatientService#checkPatientIdentifiers(Patient) */ @Test(expected = InsufficientIdentifiersException.class) public void checkPatientIdentifiers_shouldThrowErrorWhenPatientHasNullPatientIdentifiers() throws Exception { Patient patient = new Patient(); patient.setIdentifiers(null); Context.getPatientService().checkPatientIdentifiers(patient); }
Set<PatientIdentifier> patientIdentifiers = new TreeSet<>(); patientIdentifiers.add(patientIdentifier); patient.setIdentifiers(patientIdentifiers);
public void getActiveIdentifiers_shouldReturnPreferredIdentifiersFirstInTheList() { Patient p = new Patient(); p.setIdentifiers(null); PatientIdentifier pa1 = new PatientIdentifier(); PatientIdentifier pa2 = new PatientIdentifier();
patientIdentifiers.add(patientIdentifier); patient.setIdentifiers(patientIdentifiers);