55import static org .junit .jupiter .api .Assertions .assertThrows ;
66import static org .mockito .ArgumentMatchers .any ;
77import static org .mockito .ArgumentMatchers .anyString ;
8- import static org .mockito .Mockito .lenient ;
98import static org .mockito .Mockito .when ;
109
1110import static uk .nhs .adaptors .gp2gp .common .configuration .RedactionsContext .REDACTION_INTERACTION_ID ;
@@ -209,8 +208,7 @@ class ObservationStatementMapperTest {
209208
210209 @ BeforeEach
211210 void setUp () {
212- lenient ().when (randomIdGeneratorService .createNewId ()).thenReturn (TEST_ID );
213- lenient ().when (randomIdGeneratorService .createNewOrUseExistingUUID (anyString ())).thenReturn (TEST_ID );
211+ when (randomIdGeneratorService .createNewOrUseExistingUUID (anyString ())).thenReturn (TEST_ID );
214212
215213 when (codeableConceptCdMapper .mapCodeableConceptToCd (any (CodeableConcept .class )))
216214 .thenReturn (CodeableConceptMapperMockUtil .NULL_FLAVOR_CODE );
@@ -254,6 +252,7 @@ void When_MappingParsedObservationWithNopat_Expect_ObservationStatementWithConfi
254252 @ ParameterizedTest
255253 @ MethodSource ("resourceFileParams" )
256254 void When_MappingObservationJson_Expect_ObservationStatementXmlOutput (String inputJson , String outputXml ) {
255+ when (randomIdGeneratorService .createNewId ()).thenReturn (TEST_ID );
257256 messageContext .getAgentDirectory ().getAgentId (buildReference (ResourceType .Practitioner , "something" ));
258257
259258 expectedOutputMessage = ResourceTestFileUtils .getFileContent (outputXml );
@@ -267,6 +266,7 @@ void When_MappingObservationJson_Expect_ObservationStatementXmlOutput(String inp
267266 @ ParameterizedTest
268267 @ MethodSource ("resourceFileParamsThrowError" )
269268 void When_MappingObservationJson_Expect_ErrorThrown (String inputJson , Class expectedClass ) {
269+ when (randomIdGeneratorService .createNewId ()).thenReturn (TEST_ID );
270270 messageContext .getAgentDirectory ().getAgentId (buildReference (ResourceType .Practitioner , "something" ));
271271
272272 var jsonInput = ResourceTestFileUtils .getFileContent (inputJson );
0 commit comments