Skip to content

Commit c775387

Browse files
committed
addressing pitest complains
1 parent 91ea318 commit c775387

File tree

2 files changed

+64
-7
lines changed

2 files changed

+64
-7
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ class ObservationMapperTest {
9090
"observation_test_group_header.json";
9191
private static final String OBSERVATION_TEST_RESULT_JSON =
9292
"observation_test_result.json";
93+
private static final String NOT_PRESENT_OBSERVATION_RESULT_JSON =
94+
"not_present_observation.json";
9395
private static final String OBSERVATION_FILING_COMMENT_JSON =
9496
"observation_filing_comment.json";
9597
private static final String OBSERVATION_ASSOCIATED_WITH_IGNORED_MEMBER_JSON =
@@ -275,17 +277,17 @@ void When_MappingTestResult_With_NopatMetaSecurity_Expect_ConfidentialityCodeWit
275277

276278
@Test
277279
void When_ObservationDoesNotContainNotPresentElements_Expect_MappedObservetionNotContainAggregateComments() {
278-
final Observation observation = getObservationResourceFromJson(OBSERVATION_TEST_RESULT_JSON);
280+
final Observation not_present_observation = getObservationResourceFromJson(NOT_PRESENT_OBSERVATION_RESULT_JSON);
281+
String expression = "//component/NarrativeStatement/text[contains(normalize-space(.), 'AGGREGATE COMMENT SET')]";
279282

280-
ConfidentialityCodeUtility.appendNopatSecurityToMetaForResource(observation);
281-
when(confidentialityService.generateConfidentialityCode(observation))
283+
ConfidentialityCodeUtility.appendNopatSecurityToMetaForResource(not_present_observation);
284+
when(confidentialityService.generateConfidentialityCode(not_present_observation))
282285
.thenReturn(Optional.of(NOPAT_HL7_CONFIDENTIALITY_CODE));
283286

284-
final String actualXml = observationMapper.mapObservationToCompoundStatement(observation);
285-
286-
String expression = "/component/NarrativeStatement/text[contains(normalize-space(.), 'AGGREGATE COMMENT SET')]";
287+
final String actualXml = observationMapper.mapObservationToCompoundStatement(not_present_observation);
288+
String wrappedXml = "<root>" + actualXml + "</root>";
287289

288-
assertThatXml(actualXml).doesNotContainXPath(expression);
290+
assertThatXml(wrappedXml).containsXPath(expression);
289291
}
290292

291293
@Test
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"resourceType": "Observation",
3+
"id": "NOT-PRESENT-OBSERVATION-32685afe-1d46-4d98-8279-39b9e96ee914",
4+
"meta":
5+
{
6+
"profile": [
7+
"https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Observation-1"
8+
]
9+
},
10+
"identifier": [
11+
{
12+
"system": "https://tools.ietf.org/html/rfc4122",
13+
"value": "2af46949-4938-4c57-bad4-c4363e1965d7"
14+
}
15+
],
16+
"status": "final",
17+
"category": [
18+
{
19+
"coding": [
20+
{
21+
"system": "http://snomed.info/sct",
22+
"code": "394595002",
23+
"display": "Pathology"
24+
}
25+
]
26+
}
27+
],
28+
"code": {
29+
"coding": [
30+
{
31+
"system": "http://snomed.info/sct",
32+
"code": "1022451000000103",
33+
"display": "Red blood cell count"
34+
}
35+
]
36+
},
37+
"subject": {
38+
"reference": "Patient/11",
39+
"display": "SKELLY, Horace"
40+
},
41+
"issued": "2019-04-06T12:00:00+00:00",
42+
"performer": [
43+
{
44+
"reference": "Organization/7",
45+
"display": "COXWOLD Surgery"
46+
}
47+
],
48+
"valueQuantity": {
49+
"value": 4.5700000000000003,
50+
"unit": "10*12/L"
51+
},
52+
"specimen": {
53+
"reference": "Specimen/756a8361-79ce-4561-afcb-a91fe19df123"
54+
}
55+
}

0 commit comments

Comments
 (0)