Rework MDM tests

This commit is contained in:
Tadgh
2021-02-17 15:05:49 -05:00
parent 6d5ee3036d
commit 9fef4fe1eb

View File

@@ -77,8 +77,7 @@ public class ExampleServerR4IT {
// Wait until the MDM message has been processed
await().until(() -> getPatients().size(), equalTo(2));
List<Patient> persons = getPatients();
Patient goldenRecord = persons.get(0);
Patient goldenRecord = getGoldenResourcePatient();
// Verify that a golden record Patient was created
assertNotNull(goldenRecord.getMeta().getTag("http://hapifhir.io/fhir/NamingSystem/mdm-record-status", "GOLDEN_RECORD"));
@@ -90,6 +89,17 @@ public class ExampleServerR4IT {
retVal.sort(comparing(o -> ((Patient) o).getMeta().getLastUpdated()).reversed());
return retVal;
}
private Patient getGoldenResourcePatient() {
Bundle bundle = ourClient.search()
.forResource(Patient.class)
.withTag("http://hapifhir.io/fhir/NamingSystem/mdm-record-status", "GOLDEN_RECORD")
.cacheControl(new CacheControlDirective().setNoCache(true)).returnBundle(Bundle.class).execute();
if (bundle.getEntryFirstRep() != null) {
return (Patient) bundle.getEntryFirstRep().getResource();
} else {
return null;
}
}
@Test
@Order(1)