@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)); }