Test data creator
This commit is contained in:
parent
e637a841a1
commit
064e4f5e15
|
@ -106,6 +106,13 @@ public interface ITestDataBuilder {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Organization.name
|
||||||
|
*/
|
||||||
|
default Consumer<IBaseResource> withName(String theStatus) {
|
||||||
|
return t -> __setPrimitiveChild(getFhirContext(), t, "name", "string", theStatus);
|
||||||
|
}
|
||||||
|
|
||||||
default Consumer<IBaseResource> withId(String theId) {
|
default Consumer<IBaseResource> withId(String theId) {
|
||||||
return t -> {
|
return t -> {
|
||||||
assertThat(theId, matchesPattern("[a-zA-Z0-9]+"));
|
assertThat(theId, matchesPattern("[a-zA-Z0-9]+"));
|
||||||
|
@ -129,6 +136,10 @@ public interface ITestDataBuilder {
|
||||||
return createResource("Patient", theModifiers);
|
return createResource("Patient", theModifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default IIdType createOrganization(Consumer<IBaseResource>... theModifiers) {
|
||||||
|
return createResource("Organization", theModifiers);
|
||||||
|
}
|
||||||
|
|
||||||
default IIdType createResource(String theResourceType, Consumer<IBaseResource>[] theModifiers) {
|
default IIdType createResource(String theResourceType, Consumer<IBaseResource>[] theModifiers) {
|
||||||
IBaseResource resource = getFhirContext().getResourceDefinition(theResourceType).newInstance();
|
IBaseResource resource = getFhirContext().getResourceDefinition(theResourceType).newInstance();
|
||||||
for (Consumer<IBaseResource> next : theModifiers) {
|
for (Consumer<IBaseResource> next : theModifiers) {
|
||||||
|
|
Loading…
Reference in New Issue