Skip to content

Commit caa8f7b

Browse files
Removedlenient
1 parent ecf8efb commit caa8f7b

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import uk.nhs.adaptors.gp2gp.common.service.ConfidentialityService;
3737
import uk.nhs.adaptors.gp2gp.common.service.FhirParseService;
3838
import uk.nhs.adaptors.gp2gp.common.service.RandomIdGeneratorService;
39-
import uk.nhs.adaptors.gp2gp.ehr.mapper.AgentDirectory;
4039
import uk.nhs.adaptors.gp2gp.ehr.mapper.IdMapper;
4140
import uk.nhs.adaptors.gp2gp.ehr.mapper.InputBundle;
4241
import uk.nhs.adaptors.gp2gp.ehr.mapper.MessageContext;
@@ -63,8 +62,6 @@ class SpecimenMapperTest {
6362
@Mock
6463
private IdMapper idMapper;
6564
@Mock
66-
private AgentDirectory agentDirectory;
67-
@Mock
6865
private ObservationMapper observationMapper;
6966
@Mock
7067
private RandomIdGeneratorService randomIdGeneratorService;
@@ -75,14 +72,7 @@ class SpecimenMapperTest {
7572

7673
@BeforeEach
7774
void setUp() {
78-
var inputBundleString = ResourceTestFileUtils.getFileContent(FHIR_INPUT_BUNDLE);
79-
var inputBundle = new FhirParseService().parseResource(inputBundleString, Bundle.class);
80-
lenient().when(messageContext.getIdMapper()).thenReturn(idMapper);
81-
lenient().when(messageContext.getAgentDirectory()).thenReturn(agentDirectory);
82-
lenient().when(messageContext.getInputBundleHolder()).thenReturn(new InputBundle(inputBundle));
83-
lenient().when(idMapper.getOrNew(any(ResourceType.class), any(IdType.class))).thenAnswer(mockId());
84-
lenient().when(agentDirectory.getAgentId(any(Reference.class))).thenAnswer(mockReference());
85-
75+
when(messageContext.getIdMapper()).thenReturn(idMapper);
8676
when(randomIdGeneratorService.createNewId()).thenReturn(TEST_ID);
8777

8878
observations = List.of(
@@ -95,7 +85,12 @@ void setUp() {
9585
void When_MappingSpecimen_Expect_XmlOutput(String inputPath, String expectedPath) {
9686
final Specimen specimen = getSpecimenResourceFromJson(inputPath);
9787
final String expectedXml = ResourceTestFileUtils.getFileContent(SPECIMEN_TEST_FILES_DIRECTORY + expectedPath);
88+
var inputBundleString = ResourceTestFileUtils.getFileContent(FHIR_INPUT_BUNDLE);
89+
var inputBundle = new FhirParseService().parseResource(inputBundleString, Bundle.class);
9890

91+
when(messageContext.getIdMapper()).thenReturn(idMapper);
92+
lenient().when(messageContext.getInputBundleHolder()).thenReturn(new InputBundle(inputBundle));
93+
when(idMapper.getOrNew(any(ResourceType.class), any(IdType.class))).thenAnswer(mockId());
9994
when(observationMapper.mapObservationToCompoundStatement(any(Observation.class)))
10095
.thenAnswer(mockObservationMapping());
10196

0 commit comments

Comments
 (0)