PatientService { public void mergePatient(Attributes attrs, Attributes priorAttrs, StoreParam storeParam) { Patient prior = updateOrCreatePatient(priorAttrs, storeParam); Patient pat = updateOrCreatePatient(attrs, storeParam); mergePatient(pat, prior); }  Patient findUniqueOrCreatePatient(Attributes data,
            StoreParam storeParam, boolean followMergedWith,
            boolean mergeAttributes); void mergeAttributes(Patient patient, Attributes data,
            StoreParam storeParam); Patient updateOrCreatePatient(Attributes data,
            StoreParam storeParam); void mergePatient(Attributes attrs, Attributes priorAttrs,
            StoreParam storeParam); List<Patient> findPatients(IDWithIssuer pid); Patient deletePatient(IDWithIssuer pid);  }
@Test public void testMergePatient() throws Exception { Attributes attrs1234Y = attrs(TEST_1234_Y, PID_1234, ISSUER_Y); Attributes attrs5678X = attrs(TEST_5678_X, PID_5678, ISSUER_X); patientService.mergePatient(attrs1234Y, attrs5678X, storeParam); Patient pat5678X = patientService.findUniqueOrCreatePatient( attrs5678X, storeParam, true, true); assertEquals(TEST_1234_Y, pat5678X.getAttributes().getString(Tag.PatientName)); }