PatientMatcher { public boolean hasMatchByIds(Patient possibleMatch, Patient searchParams) { for (Identifier possibleMatchIdentifier : possibleMatch.getIdentifiers()) { if (searchParams.getIdentifiers().contains(possibleMatchIdentifier)) { return true; } } return false; } protected  PatientMatcher(); static PatientMatcher getInstance(); boolean hasMatchByIds(Patient possibleMatch, Patient searchParams); boolean isPatientOptedInCriteriaMet(Patient possibleMatch); boolean hasMatchByDemographics(Patient possibleMatch, Patient searchParams);  }
@Test public void testHasMatchByIds_Success() { PatientMatcher patientMatcher = createPatientMatcher(); Patient patient = createPatient(); addIdentifierToPatient(patient, "12345", "1.1"); addIdentifierToPatient(patient, "qwerty", "2.2"); Patient searchParams = new Patient(); addIdentifierToPatient(searchParams, "qwerty", "2.2"); assertTrue(patientMatcher.hasMatchByIds(patient, searchParams)); }
@Test public void testHasMatchByIds_None() { PatientMatcher patientMatcher = createPatientMatcher(); Patient patient = createPatient("Joe", "Schmoe", "M", "01011950", "555-555-5555"); addIdentifierToPatient(patient, "12345", "1.1"); addIdentifierToPatient(patient, "qwerty", "2.2"); Patient searchParams = new Patient(); addIdentifierToPatient(searchParams, "qwerty", "3.3"); assertFalse(patientMatcher.hasMatchByIds(patient, searchParams)); }