### Question:
BinaryTimeTree { public CountReport countsInBins(TimeSpan overAllRange, int numberOfBins) { List<TimeSpan> tsList = overAllRange.subDivide(numberOfBins); if (tsList.isEmpty()) { return new CountReport(); } int minBinCount = Integer.MAX_VALUE; int maxBinCount = 0; int totalCount = 0; List<TimeAndCount> resultList = New.list(tsList.size()); for (TimeSpan span : tsList) { int count = countInRange(span); totalCount += count; if (count > maxBinCount) { maxBinCount = count; } if (count < minBinCount) { minBinCount = count; } resultList.add(new TimeAndCount(span, count)); } return new CountReport(totalCount, minBinCount, maxBinCount, resultList); } BinaryTimeTree();  BinaryTimeTree(int maxValuesPerNode, int maxDepth); void clear(); int countInRange(TimeSpan range); CountReport countsInBins(TimeSpan overAllRange, int numberOfBins); TIntList countsInRanges(List<TimeSpan> countTimes); List<E> findInRange(TimeSpan range); boolean insert(E tsProvider); boolean insert(List<E> collection); int internalSize(BTreeNode<E> node); int maxValuesPerNodeInteral(BTreeNode<E> node, int maxValues); int queryMaxValuesPerNode(); int size();  }### Answer:
@Test public void testCountsInBins() { TimeSpan span1 = new TimeSpanLongLong(0, 100); TimeSpan span2 = new TimeSpanLongLong(0, 50); TimeSpanProvider mock1 = createNiceMock(TimeSpanProvider.class); TimeSpanProvider mock2 = createNiceMock(TimeSpanProvider.class); expect(mock1.getTimeSpan()).andReturn(span1).anyTimes(); expect(mock2.getTimeSpan()).andReturn(span2).anyTimes(); replay(mock1, mock2); myTestObject.insert(Arrays.asList(mock1, mock2)); CountReport report = myTestObject.countsInBins(span1, 50); assertEquals(2, report.getMaxBinCount()); assertEquals(1, report.getMinBinCount()); assertEquals(76, report.getTotalCount()); }