@@ -79,20 +79,20 @@ void setUp() {
7979 final InputBundle inputBundle = new InputBundle (bundle );
8080
8181 when (messageContext .getIdMapper ())
82- .thenReturn (idMapper );
82+ .thenReturn (idMapper );
8383 when (messageContext .getInputBundleHolder ())
84- .thenReturn (inputBundle );
84+ .thenReturn (inputBundle );
8585 when (idMapper .getOrNew (ResourceType .Condition , conditionId ))
86- .thenReturn (CONDITION_ID );
86+ .thenReturn (CONDITION_ID );
8787 when (idMapper .getOrNew (any (Reference .class )))
88- .thenAnswer (answerWithId ());
88+ .thenAnswer (answerWithId ());
8989
9090 conditionLinkSetMapper = new ConditionLinkSetMapper (
91- messageContext ,
92- randomIdGeneratorService ,
93- codeableConceptCdMapper ,
94- participantMapper ,
95- confidentialityService
91+ messageContext ,
92+ randomIdGeneratorService ,
93+ codeableConceptCdMapper ,
94+ participantMapper ,
95+ confidentialityService
9696 );
9797 }
9898
@@ -103,26 +103,26 @@ void afterEach() {
103103
104104 private void initializeNullFlavorCodeableConceptMocks () {
105105 when (codeableConceptCdMapper .mapCodeableConceptToCd (any (CodeableConcept .class )))
106- .thenReturn (NULL_FLAVOR_CODE );
106+ .thenReturn (NULL_FLAVOR_CODE );
107107 }
108108
109109 private void initializeAgentDirectoryMocks () {
110110 when (messageContext .getAgentDirectory ())
111- .thenReturn (agentDirectory );
111+ .thenReturn (agentDirectory );
112112 }
113113
114114 static Stream <Arguments > testArguments () {
115115 return Stream .of (
116- Arguments .of ("condition_all_included.json" , "expected_output_linkset_1.xml" , true ),
117- Arguments .of ("condition_all_included.json" , "expected_output_linkset_2.xml" , false ),
118- Arguments .of ("condition_major_significance.json" , "expected_output_linkset_6.xml" , false ),
119- Arguments .of ("condition_related_clinical_content_list_reference.json" , "expected_output_linkset_8.xml" , false ),
120- Arguments .of ("condition_related_clinical_content_suppressed_linkage_references.json" , "expected_output_linkset_9.xml" , false ),
121- Arguments .of ("condition_2_related_clinical_content.json" , "expected_output_linkset_10.xml" , false ),
122- Arguments .of ("condition_status_active.json" , "expected_output_linkset_11.xml" , false ),
123- Arguments .of ("condition_status_inactive.json" , "expected_output_linkset_12.xml" , false ),
124- Arguments .of ("condition_dates_present.json" , "expected_output_linkset_13.xml" , false ),
125- Arguments .of ("condition_dates_not_present.json" , "expected_output_linkset_14.xml" , false )
116+ Arguments .of ("condition_all_included.json" , "expected_output_linkset_1.xml" , true ),
117+ Arguments .of ("condition_all_included.json" , "expected_output_linkset_2.xml" , false ),
118+ Arguments .of ("condition_major_significance.json" , "expected_output_linkset_6.xml" , false ),
119+ Arguments .of ("condition_related_clinical_content_list_reference.json" , "expected_output_linkset_8.xml" , false ),
120+ Arguments .of ("condition_related_clinical_content_suppressed_linkage_references.json" , "expected_output_linkset_9.xml" , false ),
121+ Arguments .of ("condition_2_related_clinical_content.json" , "expected_output_linkset_10.xml" , false ),
122+ Arguments .of ("condition_status_active.json" , "expected_output_linkset_11.xml" , false ),
123+ Arguments .of ("condition_status_inactive.json" , "expected_output_linkset_12.xml" , false ),
124+ Arguments .of ("condition_dates_present.json" , "expected_output_linkset_13.xml" , false ),
125+ Arguments .of ("condition_dates_not_present.json" , "expected_output_linkset_14.xml" , false )
126126 );
127127 }
128128
@@ -135,7 +135,7 @@ void When_MappingParsedCondition_With_RealProblem_Expect_LinkSetXml(String condi
135135 initializeAgentDirectoryMocks ();
136136 initializeNullFlavorCodeableConceptMocks ();
137137 when (agentDirectory .getAgentId (any (Reference .class )))
138- .thenAnswer (answerWithId ());
138+ .thenAnswer (answerWithId ());
139139
140140 final String actualXml = conditionLinkSetMapper .mapConditionToLinkSet (condition , isNested );
141141
@@ -144,29 +144,29 @@ void When_MappingParsedCondition_With_RealProblem_Expect_LinkSetXml(String condi
144144
145145 private static Stream <Arguments > testObservationArguments () {
146146 return Stream .of (
147- Arguments .of ("condition_no_problem.json" , "expected_output_linkset_3.xml" , true ),
148- Arguments .of ("condition_actual_problem_condition.json" , "expected_output_linkset_5.xml" , false ),
149- Arguments .of ("condition_no_problem_no_onsetdate.json" , "expected_output_linkset_18.xml" , true ),
150- Arguments .of ("condition_related_clinical_content_allergy.json" , "expected_output_linkset_19.xml" , false )
147+ Arguments .of ("condition_no_problem.json" , "expected_output_linkset_3.xml" , true ),
148+ Arguments .of ("condition_actual_problem_condition.json" , "expected_output_linkset_5.xml" , false ),
149+ Arguments .of ("condition_no_problem_no_onsetdate.json" , "expected_output_linkset_18.xml" , true ),
150+ Arguments .of ("condition_related_clinical_content_allergy.json" , "expected_output_linkset_19.xml" , false )
151151 );
152152 }
153153
154154 @ ParameterizedTest
155155 @ MethodSource ("testObservationArguments" )
156156 void When_MappingParsedCondition_With_ObservationActualProblem_Expect_LinkSetXml (
157- String conditionJson ,
158- String outputXml ,
159- boolean isNested
157+ String conditionJson ,
158+ String outputXml ,
159+ boolean isNested
160160 ) {
161161 final Condition condition = getConditionResourceFromJson (conditionJson );
162162 final String expectedXml = getXmlStringFromFile (outputXml );
163163
164164 initializeAgentDirectoryMocks ();
165165 initializeNullFlavorCodeableConceptMocks ();
166166 when (agentDirectory .getAgentId (any (Reference .class )))
167- .thenAnswer (answerWithId ());
167+ .thenAnswer (answerWithId ());
168168 when (randomIdGeneratorService .createNewId ())
169- .thenReturn (GENERATED_ID );
169+ .thenReturn (GENERATED_ID );
170170
171171 final String actualXml = conditionLinkSetMapper .mapConditionToLinkSet (condition , isNested );
172172
@@ -183,10 +183,8 @@ void When_MappingParsedConditionWithoutMappedAgent_Expect_EhrMapperException() {
183183 when (agentDirectory .getAgentId (any (Reference .class )))
184184 .thenThrow (propagatedException );
185185
186- doNothing ().when (conditionLinkSetMapperSpy ).testForValidReferences (any ());
187-
188186 assertThatThrownBy (() -> conditionLinkSetMapper .mapConditionToLinkSet (condition , false ))
189- .isEqualTo (propagatedException );
187+ .isEqualTo (propagatedException );
190188 }
191189
192190 @ Test
@@ -197,8 +195,8 @@ void When_MappingParsedConditionWithAsserterNotPractitioner_Expect_EhrMapperExce
197195 initializeNullFlavorCodeableConceptMocks ();
198196
199197 assertThatThrownBy (() -> conditionLinkSetMapper .mapConditionToLinkSet (condition , false ))
200- .isExactlyInstanceOf (EhrMapperException .class )
201- .hasMessage ("Condition.asserter must be a Practitioner" );
198+ .isExactlyInstanceOf (EhrMapperException .class )
199+ .hasMessage ("Condition.asserter must be a Practitioner" );
202200 }
203201
204202 @ Test
@@ -208,11 +206,11 @@ void When_MappingParsedCondition_With_ActualProblemImmunization_Expect_LinkSetXm
208206
209207 initializeAgentDirectoryMocks ();
210208 when (codeableConceptCdMapper .mapCodeableConceptToCdForTransformedActualProblemHeader (any (CodeableConcept .class )))
211- .thenReturn (TEST_CONDITION_CODE );
209+ .thenReturn (TEST_CONDITION_CODE );
212210 when (agentDirectory .getAgentId (any (Reference .class )))
213- .thenAnswer (answerWithId ());
211+ .thenAnswer (answerWithId ());
214212 when (randomIdGeneratorService .createNewId ())
215- .thenReturn (GENERATED_ID );
213+ .thenReturn (GENERATED_ID );
216214
217215 final String actualXml = conditionLinkSetMapper .mapConditionToLinkSet (condition , false );
218216
@@ -226,11 +224,11 @@ void When_MappingParsedCondition_With_ActualProblemMedicationRequest_Expect_Link
226224
227225 initializeAgentDirectoryMocks ();
228226 when (codeableConceptCdMapper .mapCodeableConceptToCdForTransformedActualProblemHeader (any (CodeableConcept .class )))
229- .thenReturn (ACTUAL_PROBLEM_CODE );
227+ .thenReturn (ACTUAL_PROBLEM_CODE );
230228 when (agentDirectory .getAgentId (any (Reference .class )))
231- .thenAnswer (answerWithId ());
229+ .thenAnswer (answerWithId ());
232230 when (randomIdGeneratorService .createNewId ())
233- .thenReturn (GENERATED_ID );
231+ .thenReturn (GENERATED_ID );
234232
235233 final String actualXml = conditionLinkSetMapper .mapConditionToLinkSet (condition , false );
236234
@@ -244,9 +242,9 @@ void When_MappingParsedCondition_With_AllergyIntolerance_Expect_LinkSetXml() {
244242
245243 initializeAgentDirectoryMocks ();
246244 when (codeableConceptCdMapper .mapCodeableConceptToCdForTransformedActualProblemHeader (any (CodeableConcept .class )))
247- .thenReturn (TEST_CONDITION_CODE );
245+ .thenReturn (TEST_CONDITION_CODE );
248246 when (agentDirectory .getAgentId (any (Reference .class )))
249- .thenAnswer (answerWithId ());
247+ .thenAnswer (answerWithId ());
250248 when (randomIdGeneratorService .createNewId ())
251249 .thenReturn (GENERATED_ID );
252250
@@ -260,8 +258,8 @@ void When_MappingParsedConditionCodeIsMissing_Expect_MapperException() {
260258 final Condition condition = getConditionResourceFromJson ("condition_missing_code.json" );
261259
262260 assertThatThrownBy (() -> conditionLinkSetMapper .mapConditionToLinkSet (condition , false ))
263- .isExactlyInstanceOf (EhrMapperException .class )
264- .hasMessage ("Condition code not present" );
261+ .isExactlyInstanceOf (EhrMapperException .class )
262+ .hasMessage ("Condition code not present" );
265263 }
266264
267265 @ Test
@@ -272,7 +270,7 @@ void When_MappingParsedConditionWithNoRelatedClinicalContent_Expect_LinkSetXml()
272270 initializeAgentDirectoryMocks ();
273271 initializeNullFlavorCodeableConceptMocks ();
274272 when (agentDirectory .getAgentId (any (Reference .class )))
275- .thenAnswer (answerWithId ());
273+ .thenAnswer (answerWithId ());
276274
277275 final String actualXml = conditionLinkSetMapper .mapConditionToLinkSet (condition , false );
278276
@@ -287,7 +285,7 @@ void When_MappingConditionWithSuppressedMedicationRequestAsRelatedClinicalConten
287285 initializeAgentDirectoryMocks ();
288286 initializeNullFlavorCodeableConceptMocks ();
289287 when (agentDirectory .getAgentId (any (Reference .class )))
290- .thenAnswer (answerWithId ());
288+ .thenAnswer (answerWithId ());
291289
292290 final String actualXml = conditionLinkSetMapper .mapConditionToLinkSet (condition , false );
293291
@@ -310,7 +308,7 @@ void When_MappingCondition_With_NopatMetaSecurity_Expect_ConfidentialityCodeInBo
310308 final Condition condition = getConditionResourceFromJson ("condition_actual_problem_condition.json" );
311309 final String linkSetXpath = "/Root/component[1]/LinkSet/" + ConfidentialityCodeUtility .getNopatConfidentialityCodeXpathSegment ();
312310 final String observationStatementXpath = "/Root/component[2]/ObservationStatement/" + ConfidentialityCodeUtility
313- .getNopatConfidentialityCodeXpathSegment ();
311+ .getNopatConfidentialityCodeXpathSegment ();
314312 ConfidentialityCodeUtility .appendNopatSecurityToMetaForResource (condition );
315313
316314 initializeAgentDirectoryMocks ();
@@ -338,14 +336,12 @@ void When_MappingCondition_With_NoScrubMetaSecurity_Expect_ConfidentialityCodeNo
338336 when (confidentialityService .generateConfidentialityCode (conditionArgumentCaptor .capture ()))
339337 .thenReturn (Optional .empty ());
340338
341- doNothing ().when (conditionLinkSetMapperSpy ).testForValidReferences (any ());
342-
343339 final String actualXml = conditionLinkSetMapper .mapConditionToLinkSet (condition , false );
344340 final String conditionSecurityCode = ConfidentialityCodeUtility .getSecurityCodeFromResource (conditionArgumentCaptor .getValue ());
345341
346342 assertAll (
347- () -> assertThat (actualXml ).doesNotContainIgnoringCase (NOPAT_HL7_CONFIDENTIALITY_CODE ),
348- () -> assertThat (conditionSecurityCode ).isEqualTo (NOSCRUB )
343+ () -> assertThat (actualXml ).doesNotContainIgnoringCase (NOPAT_HL7_CONFIDENTIALITY_CODE ),
344+ () -> assertThat (conditionSecurityCode ).isEqualTo (NOSCRUB )
349345 );
350346 }
351347
0 commit comments