/** Test of highlight method, of class HighlightGlossaryTerms. */ @Test public void testHighlightWithLink() { String term = "Bart Simpson"; String publication = "<a href=\"www.simpson.com\" id=\"Bart Simpson\">Bart Simpson</a>"; String definition = "Skatter"; String className = "cool"; boolean onlyFirst = true; HighlightGlossaryTerms instance = new HighlightGlossaryTerms(); String expResult = "<a href=\"www.simpson.com\" id=\"Bart Simpson\">Bart Simpson</a>"; String result = instance.highlight(term, publication, definition, className, onlyFirst); assertEquals(expResult, result); }
@Test public void testHighlightWithLinkInParagraph() { String term = "Bart Simpson"; String publication = "<p>Bart Simpson is the cooleast sk8ter in the world. Miss Krabappel doesn't see le good part in <a href=\"www.simpson.com\" id=\"Bart Simpson\">Bart Simpson</a>.</p>"; String definition = "Skatter"; String className = "cool"; boolean onlyFirst = false; HighlightGlossaryTerms instance = new HighlightGlossaryTerms(); String expResult = "<p><a href=\"#\" class=\"cool\" title=\"Skatter\">Bart Simpson</a> is the cooleast sk8ter in the world. Miss Krabappel doesn't see le good part in <a href=\"www.simpson.com\" id=\"Bart Simpson\">Bart Simpson</a>.</p>"; String result = instance.highlight(term, publication, definition, className, onlyFirst); assertEquals(expResult, result); }