Skip to content

Commit 4b3c2e1

Browse files
werg
1 parent 707ae92 commit 4b3c2e1

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

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

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@ public class AllergyStructureMapperTest {
4242
private static final String TEST_FILE_DIRECTORY = "/ehr/mapper/allergy/";
4343
private static final String INPUT_JSON_BUNDLE = TEST_FILE_DIRECTORY + "fhir-bundle.json";
4444
private static final String INPUT_JSON_WITH_OPTIONAL_TEXT_FIELDS = TEST_FILE_DIRECTORY + "input-with-optional-text-fields.json";
45+
private static final String INPUT_WITH_ENV_CATEGORY = "input-with-environment-category.json";
46+
private static final String EXPECTED_WITH_ENV_CATEGORY = "expected-uses-environment-category.xml";
47+
48+
private static final String INPUT_WITH_CONDITION_ONE_NOTE = "input-with-relation-to-condition-with-one-note.json";
49+
private static final String EXPECTED_WITH_CONDITION_ONE_NOTE = "expected-uses-relation-to-condition-with-one-note.xml";
50+
51+
private static final String INPUT_WITH_CONDITION_TWO_NOTES = "input-with-relation-to-condition-with-two-notes.json";
52+
private static final String EXPECTED_WITH_CONDITION_TWO_NOTES = "expected-uses-relation-to-condition-with-two-notes.xml";
53+
54+
private static final String INPUT_WITH_NO_CONDITION = "input-with-no-relation-to-condition.json";
55+
private static final String EXPECTED_WITH_NO_CONDITION = "expected-uses-no-relation-to-condition.xml";
4556

4657
private static final String COMMON_ID = "6D340A1B-BC15-4D4E-93CF-BBCB5B74DF73";
4758

@@ -91,12 +102,10 @@ private static Stream<Arguments> resourceFileParams() {
91102

92103
private static Stream<Arguments> resourceFileParamsWithEnvironmentCategoryAndConditionRelatedData() {
93104
return Stream.of(
94-
Arguments.of("input-with-environment-category.json", "expected-uses-environment-category.xml"),
95-
Arguments.of
96-
("input-with-relation-to-condition-with-one-note.json", "expected-uses-relation-to-condition-with-one-note.xml"),
97-
Arguments.of
98-
("input-with-relation-to-condition-with-two-notes.json", "expected-uses-relation-to-condition-with-two-notes.xml"),
99-
Arguments.of("input-with-no-relation-to-condition.json", "expected-uses-no-relation-to-condition.xml")
105+
Arguments.of(INPUT_WITH_ENV_CATEGORY, EXPECTED_WITH_ENV_CATEGORY),
106+
Arguments.of(INPUT_WITH_CONDITION_ONE_NOTE, EXPECTED_WITH_CONDITION_ONE_NOTE),
107+
Arguments.of(INPUT_WITH_CONDITION_TWO_NOTES, EXPECTED_WITH_CONDITION_TWO_NOTES),
108+
Arguments.of(INPUT_WITH_NO_CONDITION, EXPECTED_WITH_NO_CONDITION)
100109
);
101110
}
102111

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import static org.assertj.core.api.AssertionsForClassTypes.assertThatCode;
55
import static org.mockito.ArgumentMatchers.any;
66
import static org.mockito.ArgumentMatchers.eq;
7-
import static org.mockito.Mockito.lenient;
87
import static org.mockito.Mockito.when;
98

109
import org.hl7.fhir.dstu3.model.IdType;
@@ -41,8 +40,7 @@ void before() {
4140
when(messageContext.getIdMapper()).thenReturn(idMapper);
4241
when(idMapper.getOrNew(eq(ResourceType.Observation), any(IdType.class)))
4342
.thenReturn(MAPPED_ID);
44-
lenient().when(randomIdGeneratorService.createNewId()).thenReturn(RANDOM_ID);
45-
lenient().when(observation.getResourceType()).thenReturn(ResourceType.Observation);
43+
when(observation.getResourceType()).thenReturn(ResourceType.Observation);
4644
when(observation.getIdElement()).thenReturn(new IdType());
4745
multiStatementObservationHolder = new MultiStatementObservationHolder(
4846
observation, messageContext, randomIdGeneratorService
@@ -51,6 +49,8 @@ void before() {
5149

5250
@Test
5351
void When_NextHl7InstanceIdentifier_Expect_FirstIsMappedSecondIsRandomAndVerifies() {
52+
when(randomIdGeneratorService.createNewId()).thenReturn(RANDOM_ID);
53+
5454
assertThat(multiStatementObservationHolder.nextHl7InstanceIdentifier())
5555
.isEqualTo(MAPPED_ID);
5656
assertThatCode(() -> multiStatementObservationHolder.verifyObservationWasMapped())

0 commit comments

Comments
 (0)