One more test data builder

This commit is contained in:
jamesagnew 2020-09-11 11:42:47 -04:00
parent 2bd304ffae
commit e637a841a1
1 changed files with 12 additions and 0 deletions

View File

@ -167,6 +167,18 @@ public interface ITestDataBuilder {
}; };
} }
default Consumer<IBaseResource> withOrganization(@Nullable IIdType theHasMember) {
return t -> {
if (theHasMember != null) {
IBaseReference reference = (IBaseReference) getFhirContext().getElementDefinition("Reference").newInstance();
reference.setReference(theHasMember.getValue());
RuntimeResourceDefinition resourceDef = getFhirContext().getResourceDefinition(t.getClass());
resourceDef.getChildByName("organization").getMutator().addValue(t, reference);
}
};
}
/** /**
* Users of this API must implement this method * Users of this API must implement this method
*/ */