@Test(expected = PermissionDenied.class)
 public void testCreateLinkWithoutPermission() throws Exception {
   linkViews.createLink(
       "c1",
       "a1",
       Lists.newArrayList("ur1"),
       getLinkBundle("won't work!", "too bad!"),
       invalidUser);
 }
 @Test
 public void testCreateLink() throws Exception {
   DocumentaryUnit src = manager.getFrame("c1", DocumentaryUnit.class);
   HistoricalAgent dst = manager.getFrame("a1", HistoricalAgent.class);
   UndeterminedRelationship rel = manager.getFrame("ur1", UndeterminedRelationship.class);
   String linkDesc = "Test Link";
   String linkType = "subjectAccess";
   Bundle linkBundle = getLinkBundle(linkDesc, linkType);
   Link link = linkViews.createLink("c1", "a1", Lists.newArrayList("ur1"), linkBundle, validUser);
   assertEquals(linkDesc, link.getDescription());
   assertEquals(2L, Iterables.size(link.getLinkTargets()));
   assertTrue(Iterables.contains(link.getLinkTargets(), src));
   assertTrue(Iterables.contains(link.getLinkTargets(), dst));
   assertEquals(1L, Iterables.size(link.getLinkBodies()));
   assertTrue(Iterables.contains(link.getLinkBodies(), rel));
 }
 @Test
 public void testCreateAccessPointLink() throws Exception {
   DocumentaryUnit src = manager.getFrame("c1", DocumentaryUnit.class);
   HistoricalAgent dst = manager.getFrame("a1", HistoricalAgent.class);
   DocumentDescription desc = manager.getFrame("cd1", DocumentDescription.class);
   String linkDesc = "Test Link";
   String linkType = "subjectAccess";
   Bundle linkBundle = getLinkBundle(linkDesc, linkType);
   Link link =
       linkViews.createAccessPointLink(
           "c1", "a1", "cd1", linkDesc, linkType, linkBundle, validUser);
   assertEquals(linkDesc, link.getDescription());
   assertEquals(2L, Iterables.size(link.getLinkTargets()));
   assertTrue(Iterables.contains(link.getLinkTargets(), src));
   assertTrue(Iterables.contains(link.getLinkTargets(), dst));
   assertEquals(1L, Iterables.size(link.getLinkBodies()));
   UndeterminedRelationship rel =
       manager.cast(link.getLinkBodies().iterator().next(), UndeterminedRelationship.class);
   assertEquals(rel.getName(), linkDesc);
   assertEquals(rel.getRelationshipType(), linkType);
   Description d = rel.getDescription();
   assertEquals(desc, d);
 }