@Test
 public void testValidateCorrectObjectLinkToApipProducesNoErrors() {
   final ContentLinkInfo cli = new ContentLinkInfo(accessElement);
   cli.setObjectLink(new ObjectLink(null));
   cli.setApipLinkIdentifierRef(Identifier.parseString("hello"));
   cli.validate(context);
   assertNoNotificationsRecorded();
 }
 @Test
 public void testValidateCorrectObjectLinkToQtiProducesNoErrors() {
   final String targetId = "hello";
   paragraph.setId(Identifier.parseString(targetId));
   final ContentLinkInfo cli = new ContentLinkInfo(accessElement);
   cli.setObjectLink(new ObjectLink(null));
   cli.setQtiLinkIdentifierRef(targetId);
   cli.validate(context);
   assertNoNotificationsRecorded();
 }
 @Test
 public void testValidateMissingObjectLinkAndTextLinkProducesError() {
   final ContentLinkInfo cli = new ContentLinkInfo(accessElement);
   cli.setApipLinkIdentifierRef(Identifier.parseString("hello"));
   cli.validate(context);
   Assert.assertEquals(1, recorder.getNotifications().size());
   Assert.assertEquals(
       NotificationLevel.ERROR, recorder.getNotifications().get(0).getNotificationLevel());
   Assert.assertEquals(
       NotificationType.MODEL_VALIDATION,
       recorder.getNotifications().get(0).getNotificationType());
   Assert.assertEquals(
       "Not enough children: objectLinkOrTextLink. Expected at least: 1, but found: 0",
       recorder.getNotifications().get(0).getMessage());
 }
 @Test
 public void testValidateQtiRefButNoAssociatedQtiContentProducesError() {
   final ContentLinkInfo cli = new ContentLinkInfo(null);
   cli.setObjectLink(new ObjectLink(cli));
   cli.setQtiLinkIdentifierRef("targetId");
   cli.validate(context);
   Assert.assertEquals(1, recorder.getNotifications().size());
   Assert.assertEquals(
       NotificationLevel.ERROR, recorder.getNotifications().get(0).getNotificationLevel());
   Assert.assertEquals(
       NotificationType.MODEL_VALIDATION,
       recorder.getNotifications().get(0).getNotificationType());
   Assert.assertEquals(
       "No QTI content container found associated with this accessibility metadata",
       recorder.getNotifications().get(0).getMessage());
 }
 @Test
 public void testValidateQtiReferencesNoMatchingIdElementProducesError() {
   paragraph.setId(Identifier.parseString("wrongId"));
   final ContentLinkInfo cli = new ContentLinkInfo(accessElement);
   cli.setObjectLink(new ObjectLink(cli));
   cli.setQtiLinkIdentifierRef("targetId");
   cli.validate(context);
   Assert.assertEquals(1, recorder.getNotifications().size());
   Assert.assertEquals(
       NotificationLevel.ERROR, recorder.getNotifications().get(0).getNotificationLevel());
   Assert.assertEquals(
       NotificationType.MODEL_VALIDATION,
       recorder.getNotifications().get(0).getNotificationType());
   Assert.assertEquals(
       "contentLinkInfo with qtiLinkIdentifierRef of 'targetId' does not point to an extant Qti content element.",
       recorder.getNotifications().get(0).getMessage());
 }
 @Test
 public void testValidateHavingBothIdRefsProducesError() {
   final String targetId = "hello";
   paragraph.setId(Identifier.parseString(targetId));
   final ContentLinkInfo cli = new ContentLinkInfo(accessElement);
   cli.setObjectLink(new ObjectLink(cli));
   cli.setQtiLinkIdentifierRef(targetId);
   cli.setApipLinkIdentifierRef(Identifier.parseString("helloAgain"));
   cli.validate(context);
   Assert.assertEquals(1, recorder.getNotifications().size());
   Assert.assertEquals(
       NotificationLevel.ERROR, recorder.getNotifications().get(0).getNotificationLevel());
   Assert.assertEquals(
       NotificationType.MODEL_VALIDATION,
       recorder.getNotifications().get(0).getNotificationType());
   Assert.assertEquals(
       "contentLinkInfo must only have either qtiLinkIdentifierRef or apipLinkIdentifierRef specified, but not both.",
       recorder.getNotifications().get(0).getMessage());
 }
 @Test
 public void testValidateHavingNeitherIdRefProducesError() {
   final ContentLinkInfo cli = new ContentLinkInfo(null);
   cli.setObjectLink(new ObjectLink(null));
   cli.setQtiLinkIdentifierRef(null);
   cli.setApipLinkIdentifierRef(null);
   cli.validate(context);
   Assert.assertEquals(1, recorder.getNotifications().size());
   Assert.assertEquals(
       NotificationLevel.ERROR, recorder.getNotifications().get(0).getNotificationLevel());
   Assert.assertEquals(
       NotificationType.MODEL_VALIDATION,
       recorder.getNotifications().get(0).getNotificationType());
   Assert.assertTrue(
       recorder
           .getNotifications()
           .get(0)
           .getMessage()
           .startsWith(
               "contentLinkInfo must have either the qtiLinkIdentifierRef or apipLinkIdentifierRef specified, but both are null."));
 }