testHypertext.getContent().add(link3);
testHypertext.getContent().add(term4);
linkedText.setHypertext(testHypertext);
Hypertext returnedHypertext = linkedText.getHypertext();
// check for link
assertEquals(3, linkedText.getOffsets().size());
assertEquals(3, linkedText.getOffsetLinkMap().size());
assertEquals("5", linkedText.getOffsets().get(0).toString());
assertEquals("12", linkedText.getOffsets().get(1).toString());
assertEquals("19", linkedText.getOffsets().get(2).toString());
// check for text
assertEquals("foo1 " + "\uFFFC" + " bar1 " + "\uFFFC" + " bar2 "
+ "\uFFFC" + " foo2", linkedText.getText());
// result must be same object
assertEquals(testHypertext.getIdentifier(), returnedHypertext
.getIdentifier());
assertEquals(testHypertext, returnedHypertext);
// check content
assertEquals(7, returnedHypertext.getContent().size());
assertTrue(returnedHypertext.getContent().get(0) instanceof Term);
assertTrue(returnedHypertext.getContent().get(1) instanceof Link);
assertTrue(returnedHypertext.getContent().get(2) instanceof Term);
assertTrue(returnedHypertext.getContent().get(3) instanceof Link);
assertTrue(returnedHypertext.getContent().get(4) instanceof Term);
assertTrue(returnedHypertext.getContent().get(5) instanceof Link);
assertTrue(returnedHypertext.getContent().get(6) instanceof Term);
assertEquals("foo1 ", ((Term) returnedHypertext.getContent().get(0))
.getVisibleContent());
assertEquals("link1", ((Link) returnedHypertext.getContent().get(1))
.getVisibleContent());
assertEquals(" bar1 ", ((Term) returnedHypertext.getContent().get(2))
.getVisibleContent());
assertEquals("link2", ((Link) returnedHypertext.getContent().get(3))
.getVisibleContent());
assertEquals(" bar2 ", ((Term) returnedHypertext.getContent().get(4))
.getVisibleContent());
assertEquals("link3", ((Link) returnedHypertext.getContent().get(5))
.getVisibleContent());
assertEquals(" foo2", ((Term) returnedHypertext.getContent().get(6))
.getVisibleContent());
}