### Question:
IntervalTree { public ArrayList<E> getElementsOverlappingQuery(final int query) { final ArrayList<E> results = new ArrayList<E>(); rootNode.queryNode(results, query); return results; } IntervalTree(final E[] elements, Class<E> classE);  IntervalTree(final List<E> elements, Class<E> classE); ArrayList<E> getElementsOverlappingQuery(final int query); int size(); boolean isEmpty();  }### Answer:
@Test public void testGetElementsOverlappingQuery() { ArrayList result = testIntervalTree.getElementsOverlappingQuery(0); assertEquals(result.size(), 2); assertTrue(result.contains(elements.get(0))); assertTrue(result.contains(elements.get(4))); result = testIntervalTree.getElementsOverlappingQuery(2); assertEquals(result.size(), 2); assertTrue(result.contains(elements.get(0))); assertTrue(result.contains(elements.get(4))); result = testIntervalTree.getElementsOverlappingQuery(5); assertEquals(result.size(), 4); assertTrue(result.contains(elements.get(0))); assertTrue(result.contains(elements.get(4))); assertTrue(result.contains(elements.get(1))); assertTrue(result.contains(elements.get(5))); result = testIntervalTree.getElementsOverlappingQuery(10); assertEquals(result.size(), 6); assertTrue(result.contains(elements.get(0))); assertTrue(result.contains(elements.get(4))); assertTrue(result.contains(elements.get(1))); assertTrue(result.contains(elements.get(5))); assertTrue(result.contains(elements.get(2))); assertTrue(result.contains(elements.get(3))); result = testIntervalTree.getElementsOverlappingQuery(11); assertEquals(result.size(), 2); assertTrue(result.contains(elements.get(4))); assertTrue(result.contains(elements.get(2))); result = testIntervalTree.getElementsOverlappingQuery(25); assertEquals(result.size(), 0); result = testIntervalTree.getElementsOverlappingQuery(20); assertEquals(result.size(), 1); assertTrue(result.contains(elements.get(4))); }