@Test public void testAddLineHighlight_happyPath() throws BadLocationException { Assert.assertEquals(0, lhm.getLineHighlightCount()); lhm.addLineHighlight(1, Color.BLUE); Assert.assertEquals(1, lhm.getLineHighlightCount()); lhm.addLineHighlight(2, Color.BLUE); Assert.assertEquals(2, lhm.getLineHighlightCount()); }
@Test public void testAddLineHighlight_twoOnSameLine() throws BadLocationException { Assert.assertEquals(0, lhm.getLineHighlightCount()); lhm.addLineHighlight(1, Color.BLUE); Assert.assertEquals(1, lhm.getLineHighlightCount()); lhm.addLineHighlight(1, Color.RED); Assert.assertEquals(2, lhm.getLineHighlightCount()); }
@Test public void testRemoveAllHighlights() throws BadLocationException { lhm.addLineHighlight(1, Color.BLUE); lhm.addLineHighlight(1, Color.RED); Assert.assertEquals(2, lhm.getLineHighlightCount()); lhm.removeAllLineHighlights(); Assert.assertEquals(0, lhm.getLineHighlightCount()); } }
@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)); }