AbstractRangeTree implements RangeTree<C> { @Override public Iterable<Set<Range<C>>> intersect(final Iterable<Range<C>> query) { checkNotNull(query); List<Set<Range<C>>> result = Lists.newLinkedList(); for (Range<C> range0 : query) { for (Range<C> range1 : intersect(range0)) { result.add(ImmutableSet.of(range0, range1)); } } return result; }  @Override boolean isEmpty(); @Override boolean contains(final C location); @Override int count(final C location); @Override Iterable<Range<C>> query(final C location); @Override int count(final Range<C> query); @Override boolean intersects(final Range<C> query); @Override Iterable<Set<Range<C>>> intersect(final Iterable<Range<C>> query); @Override boolean intersects(final Iterable<Range<C>> query);  }
@Test(expected=NullPointerException.class) public void testIntersectNullRange() { create(sparse).intersect((Range<Integer>) null); }
@Test public void testIntersectSingletonSingletonRangeHit() { assertEquals(1, Iterables.size(create(singleton).intersect(singleton))); }
@Test public void testIntersectSingletonClosedRange() { assertEquals(1, Iterables.size(create(singleton).intersect(closed))); }
@Test public void testIntersectSingletonOpenRange() { assertEquals(0, Iterables.size(create(singleton).intersect(open))); }
@Test public void testIntersectSingletonClosedOpenRange() { assertEquals(1, Iterables.size(create(singleton).intersect(closedOpen))); }
@Test public void testIntersectSingletonOpenClosedRange() { assertEquals(0, Iterables.size(create(singleton).intersect(openClosed))); }
@Test public void testIntersectSparseSingletonRangeHit() { assertEquals(1, Iterables.size(create(sparse).intersect(singleton))); }
@Test public void testIntersectSparseClosedRange() { assertEquals(2, Iterables.size(create(sparse).intersect(closed))); }
@Test public void testIntersectSparseOpenRange() { assertEquals(1, Iterables.size(create(sparse).intersect(open))); }
@Test public void testIntersectSparseClosedOpenRange() { assertEquals(1, Iterables.size(create(sparse).intersect(closedOpen))); }
@Test public void testIntersectSparseOpenClosedRange() { assertEquals(2, Iterables.size(create(sparse).intersect(openClosed))); }
@Test public void testIntersectDenseSingletonRangeHit() { assertEquals(2, Iterables.size(create(dense).intersect(singleton))); }
@Test public void testIntersectDenseClosedRange() { assertEquals(101, Iterables.size(create(dense).intersect(closed))); }
@Test public void testIntersectDenseOpenRange() { assertEquals(100, Iterables.size(create(dense).intersect(open))); }
@Test public void testIntersectDenseClosedOpenRange() { assertEquals(100, Iterables.size(create(dense).intersect(closedOpen))); }
@Test public void testIntersectDenseOpenClosedRange() { assertEquals(101, Iterables.size(create(dense).intersect(openClosed))); }
@Test(expected=NullPointerException.class) public void testIntersectRanges() { create(sparse).intersect((Iterable<Range<Integer>>) null); }