public void testIteration() throws Exception { Blip blip = newBlip("\naaa 012 aaa 345 aaa 322", Collections.<Annotation>emptyList()); Range[] expectedRanges = {new Range(1, 4), new Range(9, 12), new Range(17, 20)}; BlipContentRefs blipRefs = blip.all("aaa"); int index = 0; for (Range range : blipRefs) { assertEquals(expectedRanges[index++], range); } assertEquals(3, index); // Now let's make sure that we can iterate again. index = 0; for (Range range : blipRefs) { assertEquals(expectedRanges[index++], range); } assertEquals(3, index); // Assert iteration with blip refs that has no match. assertFalse(blip.all("invalid").iterator().hasNext()); }
public void testIteration() throws Exception { Blip blip = newBlip("\naaa 012 aaa 345 aaa 322", Collections.<Annotation>emptyList()); Range[] expectedRanges = {new Range(1, 4), new Range(9, 12), new Range(17, 20)}; BlipContentRefs blipRefs = blip.all("aaa"); int index = 0; for (Range range : blipRefs) { assertEquals(expectedRanges[index++], range); } assertEquals(3, index); // Now let's make sure that we can iterate again. index = 0; for (Range range : blipRefs) { assertEquals(expectedRanges[index++], range); } assertEquals(3, index); // Assert iteration with blip refs that has no match. assertFalse(blip.all("invalid").iterator().hasNext()); }