Skip to content

Commit e032788

Browse files
committed
[NIAD-3217] Basic test implementation, fixed test data
1 parent 80b83cf commit e032788

File tree

2 files changed

+54
-36
lines changed

2 files changed

+54
-36
lines changed

service/src/test/java/uk/nhs/adaptors/gp2gp/ehr/mapper/diagnosticreport/DiagnosticReportMapperTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,29 @@ void When_DiagnosticReport_With_NoReferencedSpecimenAndFilingCommentWithNoCommen
291291
assertThat(actualXml).isEqualToIgnoringWhitespace(expectedXml);
292292
}
293293

294+
/**
295+
* TODO
296+
*
297+
* It makes no sense whatsoever to place any logic within the SpecimenMapper - what we care
298+
* about here is a DiagnosticReport with a Test Result (Observation). If the Observation has
299+
* a related specimen - then this should be picked up by the SpecimenMapper.
300+
*
301+
* If there is an Observation (Test Result) WITHOUT a Specimen, then this I think should be handled
302+
* within the ObservationMapper.
303+
*/
304+
294305
@Test
295306
void When_DiagnosticReport_With_SpecimenAndTestResultWithNoSpecimen_Expect_TestResultDataToBePresentWithinObservationStatement() {
307+
final String diagnosticReportFileName = "diagnostic-report-with-one-specimen-and-test-result-with-no-specimen.json";
308+
final DiagnosticReport diagnosticReport = getDiagnosticReportResourceFromJson(diagnosticReportFileName);
309+
final Bundle bundle = getBundleResourceFromJson(INPUT_JSON_BUNDLE);
310+
final InputBundle inputBundle = new InputBundle(bundle);
311+
312+
when(messageContext.getInputBundleHolder()).thenReturn(inputBundle);
313+
314+
final String actualXml = mapper.mapDiagnosticReportToCompoundStatement(diagnosticReport);
296315

316+
assertThat(actualXml).contains("ObservationStatement");
297317
}
298318

299319
private Bundle getBundleResourceFromJson(String filename) {
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,39 @@
11
{
2-
"resource": {
3-
"resourceType": "DiagnosticReport",
4-
"id": "486785FA-C3A5-4AB2-B317-FF9C24A3FDBC",
5-
"meta": {
6-
"profile": [
7-
"https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-DiagnosticReport-1"
8-
]
9-
},
10-
"identifier": [
11-
{
12-
"system": "https://wiremock/",
13-
"value": "486785FA-C3A5-4AB2-B317-FF9C24A3FDBC"
14-
}
15-
],
16-
"status": "unknown",
17-
"code": {
18-
"coding": [
19-
{
20-
"system": "http://snomed.info/sct",
21-
"code": "721981007",
22-
"display": "Diagnostic studies report"
23-
}
24-
]
25-
},
26-
"subject": {
27-
"reference": "Patient/DAED5527-1985-45D9-993E-C5FF51F36828"
28-
},
29-
"issued": "2001-02-03T09:00:00+00:00",
30-
"specimen": [
31-
{
32-
"reference": "Specimen/NON-SIGNIFICANT-SPECIMEN"
33-
}
34-
],
35-
"result": [
2+
"resourceType": "DiagnosticReport",
3+
"id": "486785FA-C3A5-4AB2-B317-FF9C24A3FDBC",
4+
"meta": {
5+
"profile": [
6+
"https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-DiagnosticReport-1"
7+
]
8+
},
9+
"identifier": [
10+
{
11+
"system": "https://wiremock/",
12+
"value": "486785FA-C3A5-4AB2-B317-FF9C24A3FDBC"
13+
}
14+
],
15+
"status": "unknown",
16+
"code": {
17+
"coding": [
3618
{
37-
"reference": "Observation/TEST-RESULT-NO-SPECIMEN"
19+
"system": "http://snomed.info/sct",
20+
"code": "721981007",
21+
"display": "Diagnostic studies report"
3822
}
3923
]
40-
}
24+
},
25+
"subject": {
26+
"reference": "Patient/DAED5527-1985-45D9-993E-C5FF51F36828"
27+
},
28+
"issued": "2001-02-03T09:00:00+00:00",
29+
"specimen": [
30+
{
31+
"reference": "Specimen/NON-SIGNIFICANT-SPECIMEN"
32+
}
33+
],
34+
"result": [
35+
{
36+
"reference": "Observation/TEST-RESULT-NO-SPECIMEN"
37+
}
38+
]
4139
}

0 commit comments

Comments
 (0)