@Test public void testGetCurrentLineHighlightTags() throws BadLocationException { Assert.assertEquals(0, lhm.getCurrentLineHighlightTags().size()); Object tag1 = lhm.addLineHighlight(0, Color.RED); Object tag2 = lhm.addLineHighlight(2, Color.BLUE); List<Object> actualTags = lhm.getCurrentLineHighlightTags(); Assert.assertEquals(2, actualTags.size()); Assert.assertEquals(tag1, actualTags.get(0)); Assert.assertEquals(tag2, actualTags.get(1)); }
@Test public void testAddLineHighlight_removeOneOfTwoOnOneLine() throws BadLocationException { Object tag1 = lhm.addLineHighlight(1, Color.BLUE); Object tag2 = lhm.addLineHighlight(1, Color.RED); Assert.assertEquals(2, lhm.getLineHighlightCount()); // We're testing a bug here with LineHighlightInfo's equals() method, // so we use a foolproof method of telling the two tags apart. lhm.removeLineHighlight(tag1); List<Object> remainingTags = lhm.getCurrentLineHighlightTags(); Assert.assertEquals(1, remainingTags.size()); Assert.assertTrue(tag2 == remainingTags.get(0)); }