diff --git a/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/ITestDataBuilder.java b/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/ITestDataBuilder.java index 74ece7fe5f2..56066257cf8 100644 --- a/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/ITestDataBuilder.java +++ b/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/ITestDataBuilder.java @@ -106,6 +106,13 @@ public interface ITestDataBuilder { }; } + /** + * Set Organization.name + */ + default Consumer withName(String theStatus) { + return t -> __setPrimitiveChild(getFhirContext(), t, "name", "string", theStatus); + } + default Consumer withId(String theId) { return t -> { assertThat(theId, matchesPattern("[a-zA-Z0-9]+")); @@ -129,6 +136,10 @@ public interface ITestDataBuilder { return createResource("Patient", theModifiers); } + default IIdType createOrganization(Consumer... theModifiers) { + return createResource("Organization", theModifiers); + } + default IIdType createResource(String theResourceType, Consumer[] theModifiers) { IBaseResource resource = getFhirContext().getResourceDefinition(theResourceType).newInstance(); for (Consumer next : theModifiers) {