1
1
package de .medizininformatikinitiative .torch ;
2
2
3
3
import de .medizininformatikinitiative .torch .assertions .BundleAssert ;
4
+ import org .hl7 .fhir .r4 .model .Bundle ;
4
5
import org .hl7 .fhir .r4 .model .ResourceType ;
5
6
import org .junit .jupiter .api .AfterAll ;
6
7
import org .junit .jupiter .api .BeforeAll ;
12
13
import java .io .IOException ;
13
14
import java .nio .file .Files ;
14
15
import java .nio .file .Path ;
16
+ import java .util .List ;
15
17
16
18
import static de .medizininformatikinitiative .torch .TestUtils .nodeFromValueString ;
17
19
import static de .medizininformatikinitiative .torch .assertions .Assertions .assertThat ;
@@ -37,7 +39,7 @@ static void setUp() throws IOException {
37
39
38
40
torchClient = environment .torchClient ();
39
41
fileServerClient = environment .fileServerClient ();
40
- var blazeClient = environment .blazeClient ();
42
+ FhirClient blazeClient = environment .blazeClient ();
41
43
42
44
logger .info ("Uploading test data..." );
43
45
var bundle = Files .readString (Path .of ("target/kds-testdata-2024.0.1/resources/Bundle-mii-exa-test-data-bundle.json" ));
@@ -57,8 +59,8 @@ public void testExamples() throws IOException {
57
59
var statusResponse = torchClient .pollStatus (statusUrl ).block ();
58
60
assertThat (statusResponse ).isNotNull ();
59
61
60
- var coreBundles = statusResponse .coreBundleUrl ().stream ().flatMap (fileServerClient ::fetchBundles ).toList ();
61
- var patientBundles = statusResponse .patientBundleUrls ().stream ().flatMap (fileServerClient ::fetchBundles ).toList ();
62
+ List < Bundle > coreBundles = statusResponse .coreBundleUrl ().stream ().flatMap (fileServerClient ::fetchBundles ).toList ();
63
+ List < Bundle > patientBundles = statusResponse .patientBundleUrls ().stream ().flatMap (fileServerClient ::fetchBundles ).toList ();
62
64
63
65
assertThat (coreBundles , BundleAssert .class ).singleElement ().containsNEntries (0 );
64
66
assertThat (patientBundles ).hasSize (3 );
@@ -110,10 +112,13 @@ public void testExamples() throws IOException {
110
112
.extractElementsAt ("code.coding.code" )
111
113
.containsExactly (nodeFromValueString ("C16.9" )));
112
114
113
- // test that IDs are properly formatted
114
115
assertThat (patientBundles ).allSatisfy (bundle ->
115
116
assertThat (bundle ).extractResourcesByType (ResourceType .Condition ).allSatisfy (
116
117
r -> assertThat (r ).extractChildrenStringsAt ("subject.reference" ).satisfiesExactly (id -> assertThat (id ).startsWith ("Patient/" ))
117
118
));
119
+
120
+ assertThat (patientBundles ).allSatisfy (bundle ->
121
+ assertThat (bundle ).allRequestsMatchResourceIdentity ());
122
+
118
123
}
119
124
}
0 commit comments