@@ -50,6 +50,7 @@ void setUp() {
5050 messageContext = new MessageContext (randomIdGeneratorService );
5151 agentDirectoryMapper = new AgentDirectoryMapper (messageContext , agentPersonMapper );
5252 fhirParseService = new FhirParseService ();
53+ when (randomIdGeneratorService .createNewId ()).thenReturn (TEST_ID );
5354 }
5455
5556 @ AfterEach
@@ -89,7 +90,6 @@ private void initializeMessageContextWithAgentKeys(Bundle bundle) {
8990
9091 @ Test
9192 void When_MappingAgentDirectory_Expect_CorrectOutputFromMapper () {
92- when (randomIdGeneratorService .createNewId ()).thenReturn (TEST_ID );
9393 when (agentPersonMapper .mapAgentPerson (any (), any ())).thenAnswer (answerWithObjectId ());
9494
9595 var bundle = parseBundle (INPUT_AGENT_DIRECTORY );
@@ -103,8 +103,6 @@ void When_MappingAgentDirectory_Expect_CorrectOutputFromMapper() {
103103
104104 @ Test
105105 void When_MappingAgentDirectoryWithoutPatientManagingOrganizationReference_Expect_Exception () {
106- when (randomIdGeneratorService .createNewId ()).thenReturn (TEST_ID );
107-
108106 var bundle = parseBundle (INPUT_AGENT_DIRECTORY_WITHOUT_MANAGING_ORGANIZATION_REFERENCE );
109107 initializeMessageContextWithAgentKeys (bundle );
110108
@@ -115,8 +113,6 @@ void When_MappingAgentDirectoryWithoutPatientManagingOrganizationReference_Expec
115113
116114 @ Test
117115 void When_MappingAgentDirectoryWithoutPatientManagingOrganizationResource_Expect_Exception () {
118- when (randomIdGeneratorService .createNewId ()).thenReturn (TEST_ID );
119-
120116 var bundle = parseBundle (INPUT_AGENT_DIRECTORY_WITHOUT_MANAGING_ORGANIZATION_RESOURCE );
121117 initializeMessageContextWithAgentKeys (bundle );
122118
@@ -127,7 +123,6 @@ void When_MappingAgentDirectoryWithoutPatientManagingOrganizationResource_Expect
127123
128124 @ Test
129125 void When_MappingAgentDirectoryWithPatientManagingOrganizationInAgentKeys_Expect_AgentPersonNotDuplicated () {
130- when (randomIdGeneratorService .createNewId ()).thenReturn (TEST_ID );
131126 when (agentPersonMapper .mapAgentPerson (any (), any ())).thenAnswer (answerWithObjectId ());
132127
133128 var bundle = parseBundle (INPUT_AGENT_DIRECTORY );
@@ -144,8 +139,6 @@ void When_MappingAgentDirectoryWithPatientManagingOrganizationInAgentKeys_Expect
144139
145140 @ Test
146141 void When_MappingAgentKeysWithoutAgentKeys_Expect_CorrectOutputFromMapper () {
147- when (randomIdGeneratorService .createNewId ()).thenReturn (TEST_ID );
148-
149142 var bundle = parseBundle (INPUT_AGENT_DIRECTORY );
150143 messageContext .initialize (bundle );
151144
0 commit comments