@Test
public void testAreInstructionsLinkedByUpdate()
{

  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);
  assertTrue(
      medicationsBo.areInstructionsLinkedByUpdate(
          Pair.of(composition2, instruction2),
          Pair.of(composition1, instruction1))
  );
  assertTrue(
      medicationsBo.areInstructionsLinkedByUpdate(
          Pair.of(composition1, instruction1),
          Pair.of(composition2, instruction2))
  );
}