@Test
public void testTherapyModifiedFromLastReviewWithUpdateLink()
{

  final MedicationOrderComposition composition1 =
      MedicationsTestUtils.buildTestMedicationOrderComposition("uid1::1", null, null);
  final MedicationOrderComposition composition2 =
      MedicationsTestUtils.buildTestMedicationOrderComposition("uid2::1", null, null);
  final MedicationInstructionInstruction instruction1 =
      MedicationsTestUtils.buildTestMedicationInstruction("MedicationInstructionInstruction 1");
  composition1.getMedicationDetail().getMedicationInstruction().add(instruction1);
  final MedicationInstructionInstruction instruction2 =
      MedicationsTestUtils.buildTestMedicationInstruction("MedicationInstructionInstruction 2");
  composition2.getMedicationDetail().getMedicationInstruction().add(instruction2);
  final Link linkToInstruction1 =
      OpenEhrRefUtils.getLinkToTdoTarget("update", EhrLinkType.UPDATE.getName(), composition1, instruction1);
  instruction2.getLinks().add(linkToInstruction1);
  final List<MedicationActionAction> actionsList = new ArrayList<>();
  actionsList.add(
      MedicationsTestUtils.buildMedicationAction(MedicationActionEnum.SCHEDULE, new DateTime(2013, 5, 10, 12, 0)));
  actionsList.add(
      MedicationsTestUtils.buildMedicationAction(MedicationActionEnum.START, new DateTime(2013, 5, 10, 12, 0)));
  actionsList.add(
      MedicationsTestUtils.buildMedicationAction(MedicationActionEnum.REVIEW, new DateTime(2013, 5, 10, 12, 0)));
  actionsList.add(
      MedicationsTestUtils.buildMedicationAction(MedicationActionEnum.REVIEW, new DateTime(2013, 5, 11, 12, 0)));
  actionsList.add(
      MedicationsTestUtils.buildMedicationAction(MedicationActionEnum.REVIEW, new DateTime(2013, 5, 12, 12, 0)));
  final boolean modified1 =
      medicationsBo.isTherapyModifiedFromLastReview(instruction2, actionsList, new DateTime(2013, 5, 13, 5, 0));
  assertTrue(modified1);
  final boolean modified2 =
      medicationsBo.isTherapyModifiedFromLastReview(instruction2, actionsList, new DateTime(2013, 5, 12, 5, 0));
  assertFalse(modified2);
}