@@ -305,7 +305,30 @@ void When_MappingParsedCondition_With_RelatedClinicalContentAllergy_Expect_LinkS
305305 assertThat (actualXml ).isEqualTo (expectedXml );
306306 }
307307
308- // It works but the indentation is giving me pain in the test comparison
308+ @ Test
309+ void When_MappingParsedCondition_With_ActualProblemMedicationRequest_Expect_LinkSetXml () {
310+ final Condition condition = getConditionResourceFromJson (INPUT_JSON_WITH_ACTUAL_PROBLEM_MEDICATION_REQUEST );
311+ final String expectedXml = getXmlStringFromFile (OUTPUT_XML_MEDICATION_REQUEST_ACTUAL_PROBLEM );
312+
313+ when (codeableConceptCdMapper .mapCodeableConceptToCdForTransformedActualProblemHeader (
314+ any (CodeableConcept .class )))
315+ .thenReturn (CodeableConceptMapperMockUtil .ACTUAL_PROBLEM_CODE );
316+ when (messageContext .getIdMapper ()).thenReturn (idMapper );
317+ when (messageContext .getAgentDirectory ()).thenReturn (agentDirectory );
318+ when (messageContext .getInputBundleHolder ()).thenReturn (inputBundle );
319+
320+ IdType conditionId = buildIdType (ResourceType .Condition , CONDITION_ID );
321+ when (idMapper .getOrNew (ResourceType .Condition , conditionId )).thenReturn (CONDITION_ID );
322+ when (idMapper .getOrNew (any (Reference .class ))).thenAnswer (answerWithObjectId (ResourceType .Condition ));
323+ when (agentDirectory .getAgentId (any (Reference .class ))).thenAnswer (answerWithObjectId ());
324+ when (randomIdGeneratorService .createNewId ()).thenReturn (GENERATED_ID );
325+ lenient ().doNothing ().when (conditionLinkSetMapperSpy ).testForValidReferences (any ());
326+
327+ final String actualXml = conditionLinkSetMapperSpy .mapConditionToLinkSet (condition , false );
328+
329+ assertThat (actualXml ).isEqualTo (expectedXml );
330+ }
331+
309332 @ Test
310333 void When_MappingParsedCondition_With_AllergyIntolerance_Expect_LinkSetXml () {
311334 final Condition condition =
@@ -512,8 +535,7 @@ private static Stream<Arguments> testObservationArguments() {
512535 return Stream .of (
513536 Arguments .of (INPUT_JSON_NO_ACTUAL_PROBLEM , OUTPUT_XML_WITH_GENERATED_PROBLEM_IS_NESTED , true ),
514537 Arguments .of (INPUT_JSON_NO_ACTUAL_PROBLEM_NO_DATE , OUTPUT_XML_WITH_NULL_FLAVOR_OBSERVATION_STATEMENT_AVAILABILITY_TIME ,
515- true ),
516- Arguments .of (INPUT_JSON_WITH_ACTUAL_PROBLEM_MEDICATION_REQUEST , OUTPUT_XML_MEDICATION_REQUEST_ACTUAL_PROBLEM , false )
538+ true )
517539 );
518540 }
519541
0 commit comments