One more test data builder
This commit is contained in:
parent
2bd304ffae
commit
e637a841a1
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue