Skip to content

Commit 22c1e99

Browse files
committed
test adjustments
1 parent b16a4c0 commit 22c1e99

12 files changed

+17
-16
lines changed

service/src/main/java/uk/nhs/adaptors/gp2gp/ehr/mapper/diagnosticreport/DiagnosticReportMapper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
@Slf4j
5353
public class DiagnosticReportMapper {
5454

55-
public static final String DUMMY_SPECIMEN_ID_PREFIX = "DUMMY-SPECIMEN-";
55+
public static final String NOT_PRESENT_SPECIMEN_ID_PREFIX = "NOT-PRESENT-SPECIMEN-";
5656
public static final String DUMMY_OBSERVATION_ID_PREFIX = "DUMMY-OBSERVATION-";
5757

5858
private static final Mustache DIAGNOSTIC_REPORT_COMPOUND_STATEMENT_TEMPLATE =
@@ -181,7 +181,7 @@ private List<Observation> assignDummySpecimensToObservationsWithNoSpecimen(
181181

182182
// The assumption was made that all test results without a specimen will have the same dummy specimen referenced
183183
Specimen dummySpecimen = specimens.stream()
184-
.filter(specimen -> specimen.getId().contains(DUMMY_SPECIMEN_ID_PREFIX))
184+
.filter(specimen -> specimen.getId().contains(NOT_PRESENT_SPECIMEN_ID_PREFIX))
185185
.toList().getFirst();
186186

187187
Reference dummySpecimenReference = new Reference(dummySpecimen.getId());
@@ -199,7 +199,7 @@ private List<Observation> assignDummySpecimensToObservationsWithNoSpecimen(
199199
private Specimen generateDummySpecimen(DiagnosticReport diagnosticReport) {
200200
Specimen specimen = new Specimen();
201201

202-
specimen.setId(DUMMY_SPECIMEN_ID_PREFIX + randomIdGeneratorService.createNewId());
202+
specimen.setId(NOT_PRESENT_SPECIMEN_ID_PREFIX + randomIdGeneratorService.createNewId());
203203

204204
return specimen
205205
.setAccessionIdentifier(new Identifier().setValue("NOT PRESENT"))
@@ -247,7 +247,7 @@ private List<String> getSpecimenIdsWithoutObservation(List<Specimen> specimens,
247247
List<String> nonOrphanSpecimenIDList = new ArrayList<>();
248248
for (Specimen specimen : specimens) {
249249
// Dummy Specimens should not have a dummy observation attached.
250-
if (!specimen.getId().contains(DUMMY_SPECIMEN_ID_PREFIX)) {
250+
if (!specimen.getId().contains(NOT_PRESENT_SPECIMEN_ID_PREFIX)) {
251251
specimenIDList.add(specimen.getId());
252252
}
253253
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
@ExtendWith(MockitoExtension.class)
5555
@MockitoSettings(strictness = Strictness.LENIENT)
5656
class DiagnosticReportMapperTest {
57+
5758
private static final String TEST_FILE_DIRECTORY = "/ehr/mapper/diagnosticreport/";
5859

5960
private static final String INPUT_JSON_BUNDLE = "fhir_bundle.json";
@@ -310,7 +311,7 @@ void When_DiagnosticReport_Has_SpecimenAndUnlinkedTestResult_Expect_ADummySpecim
310311

311312
// This checks that the unlinked test result is given a dummy specimen.
312313
assertThat(actualXml).containsIgnoringWhitespaces(
313-
"<!-- Mapped Specimen with id: DUMMY-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 "
314+
"<!-- Mapped Specimen with id: NOT-PRESENT-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 "
314315
+ "with linked Observations: Observation/TestResult-WithoutSpecimenReference-->");
315316
}
316317

@@ -411,7 +412,7 @@ void When_DiagnosticReport_Has_SpecimenALinkedTestResultAndAnUnlinkedTestResult_
411412
final String actualXml = mapper.mapDiagnosticReportToCompoundStatement(diagnosticReport);
412413
// This checks that the unlinked observation is given a dummy specimen.
413414
assertThat(actualXml).containsIgnoringWhitespaces(
414-
"<!-- Mapped Specimen with id: DUMMY-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 "
415+
"<!-- Mapped Specimen with id: NOT-PRESENT-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 "
415416
+ "with linked Observations: Observation/TestResult-WithoutSpecimenReference-->");
416417

417418
}

service/src/test/resources/ehr/mapper/diagnosticreport/diagnostic-report-with-coded-diagnosis.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ Status: unknown</text>
3030
<availabilityTime value="20100225154100"/>
3131
</NarrativeStatement>
3232
</component>
33-
<!-- Mapped Specimen with id: DUMMY-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757-->
33+
<!-- Mapped Specimen with id: NOT-PRESENT-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757-->
3434
</CompoundStatement>
3535
</component>

service/src/test/resources/ehr/mapper/diagnosticreport/diagnostic-report-with-conclusion.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ Status: unknown</text>
3030
<availabilityTime value="20100225154100"/>
3131
</NarrativeStatement>
3232
</component>
33-
<!-- Mapped Specimen with id: DUMMY-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 -->
33+
<!-- Mapped Specimen with id: NOT-PRESENT-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 -->
3434
</CompoundStatement>
3535
</component>

service/src/test/resources/ehr/mapper/diagnosticreport/diagnostic-report-with-extension-id.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ Status: unknown</text>
2121
<availabilityTime value="20100225154100"/>
2222
</NarrativeStatement>
2323
</component>
24-
<!-- Mapped Specimen with id: DUMMY-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 -->
24+
<!-- Mapped Specimen with id: NOT-PRESENT-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 -->
2525
</CompoundStatement>
2626
</component>

service/src/test/resources/ehr/mapper/diagnosticreport/diagnostic-report-with-multiple-coded-diagnosis.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ Status: unknown</text>
3030
<availabilityTime value="20100225154100"/>
3131
</NarrativeStatement>
3232
</component>
33-
<!-- Mapped Specimen with id: DUMMY-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 -->
33+
<!-- Mapped Specimen with id: NOT-PRESENT-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 -->
3434
</CompoundStatement>
3535
</component>

service/src/test/resources/ehr/mapper/diagnosticreport/diagnostic-report-with-multiple-results.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ CommentDate:20100225154100
6262
<availabilityTime value="20100225154100"/>
6363
</NarrativeStatement>
6464
</component>
65-
<!-- Mapped Specimen with id: DUMMY-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 -->
65+
<!-- Mapped Specimen with id: NOT-PRESENT-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 -->
6666
</CompoundStatement>
6767
</component>

service/src/test/resources/ehr/mapper/diagnosticreport/diagnostic-report-with-no-specimen.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
</component>
4949
<component typeCode="COMP" contextConductionInd="true">
5050
<CompoundStatement classCode="CLUSTER" moodCode="EVN">
51-
<id root="II-for-Specimen-DUMMY-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757"/>
51+
<id root="II-for-Specimen-NOT-PRESENT-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757"/>
5252
<code code="123038009" codeSystem="2.16.840.1.113883.2.1.3.2.4.15" displayName="specimen (specimen)"/>
5353
<statusCode code="COMPLETE"/>
5454
<effectiveTime>

service/src/test/resources/ehr/mapper/diagnosticreport/diagnostic-report-with-participant.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Participants: TEMPLE SOWERBY MEDICAL PRACTICE</text>
3030
<availabilityTime value="20100225154100"/>
3131
</NarrativeStatement>
3232
</component>
33-
<!-- Mapped Specimen with id: DUMMY-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 -->
33+
<!-- Mapped Specimen with id: NOT-PRESENT-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 -->
3434
<Participant typeCode="AUT" contextControlCode="OP">
3535
<agentRef classCode="AGNT">
3636
<id root="II-for-Organization/5E496953-065B-41F2-9577-BE8F2FBD0757"/>

service/src/test/resources/ehr/mapper/diagnosticreport/diagnostic-report-with-required-data.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ Status: unknown</text>
2020
<availabilityTime value="20100225154100"/>
2121
</NarrativeStatement>
2222
</component>
23-
<!-- Mapped Specimen with id: DUMMY-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 -->
23+
<!-- Mapped Specimen with id: NOT-PRESENT-SPECIMEN-5E496953-065B-41F2-9577-BE8F2FBD0757 -->
2424
</CompoundStatement>
2525
</component>

0 commit comments

Comments
 (0)