-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from medizininformatik-initiative/84-use-a-tra…
…nsaction-bundle-to-create-measure-and-library-resource Use a Transaction Bundle to Create Measure and Library Resource
- Loading branch information
Showing
9 changed files
with
206 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...ibility/src/test/java/de/medizininformatik_initiative/process/feasibility/Assertions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package de.medizininformatik_initiative.process.feasibility; | ||
|
||
import org.hl7.fhir.r4.model.Base; | ||
import org.hl7.fhir.r4.model.Bundle; | ||
|
||
public interface Assertions { | ||
|
||
static BaseAssert assertThat(Base actual) { | ||
return new BaseAssert(actual); | ||
} | ||
|
||
static BundleAssert assertThat(Bundle actual) { | ||
return new BundleAssert(actual); | ||
} | ||
|
||
static BundleEntryRequestComponentAssert assertThat(Bundle.BundleEntryRequestComponent actual) { | ||
return new BundleEntryRequestComponentAssert(actual); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...ibility/src/test/java/de/medizininformatik_initiative/process/feasibility/BaseAssert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package de.medizininformatik_initiative.process.feasibility; | ||
|
||
import org.assertj.core.api.AbstractAssert; | ||
import org.assertj.core.api.Condition; | ||
import org.hl7.fhir.r4.model.Base; | ||
|
||
public class BaseAssert extends AbstractAssert<BaseAssert, Base> { | ||
|
||
protected BaseAssert(Base actual) { | ||
super(actual, BaseAssert.class); | ||
} | ||
|
||
private static Condition<Base> deepEqualTo(Base expected) { | ||
return new Condition<>(actual -> actual.equalsDeep(expected), "deep equal to " + expected); | ||
} | ||
|
||
public BaseAssert isDeepEqualTo(Base expected) { | ||
return is(deepEqualTo(expected)); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...ility/src/test/java/de/medizininformatik_initiative/process/feasibility/BundleAssert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package de.medizininformatik_initiative.process.feasibility; | ||
|
||
import org.assertj.core.api.AbstractAssert; | ||
import org.assertj.core.api.Condition; | ||
import org.hl7.fhir.r4.model.Bundle; | ||
|
||
public class BundleAssert extends AbstractAssert<BundleAssert, Bundle> { | ||
|
||
protected BundleAssert(Bundle actual) { | ||
super(actual, BundleAssert.class); | ||
} | ||
|
||
public BundleAssert hasType(String type) { | ||
return has(type(type)); | ||
} | ||
|
||
private static Condition<Bundle> type(String type) { | ||
return new Condition<>(bundle -> bundle.getType().toCode().equals(type), "of type " + type); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...e/medizininformatik_initiative/process/feasibility/BundleEntryRequestComponentAssert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package de.medizininformatik_initiative.process.feasibility; | ||
|
||
import org.assertj.core.api.AbstractAssert; | ||
import org.assertj.core.api.Condition; | ||
import org.hl7.fhir.r4.model.Bundle; | ||
|
||
|
||
public class BundleEntryRequestComponentAssert extends AbstractAssert<BundleEntryRequestComponentAssert, | ||
Bundle.BundleEntryRequestComponent> { | ||
|
||
protected BundleEntryRequestComponentAssert(Bundle.BundleEntryRequestComponent actual) { | ||
super(actual, BundleEntryRequestComponentAssert.class); | ||
} | ||
|
||
public BundleEntryRequestComponentAssert hasMethod(Bundle.HTTPVerb method) { | ||
return has(method(method)); | ||
} | ||
|
||
private static Condition<Bundle.BundleEntryRequestComponent> method(Bundle.HTTPVerb method) { | ||
return new Condition<>(bundle -> bundle.getMethod() == method, "of method " + method); | ||
} | ||
|
||
public BundleEntryRequestComponentAssert hasUrl(String url) { | ||
return has(url(url)); | ||
} | ||
|
||
private static Condition<Bundle.BundleEntryRequestComponent> url(String url) { | ||
return new Condition<>(bundle -> bundle.getUrl().equals(url), "of URL " + url); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters