SlotBasedCounter implements Serializable { public Map<T, Long> getCounts() { Map<T, Long> result = new HashMap<T, Long>(); for (T obj : objToCounts.keySet()) { result.put(obj, computeTotalCount(obj)); } return result; } SlotBasedCounter(int numSlots); void incrementCount(T obj, int slot); long getCount(T obj, int slot); Map<T, Long> getCounts(); void wipeSlot(int slot); void wipeZeros();  }
@Test public void newInstanceShouldHaveEmptyCounts() { SlotBasedCounter<Object> counter = new SlotBasedCounter<Object>(ANY_NUM_SLOTS); Map<Object, Long> counts = counter.getCounts(); assertThat(counts).isEmpty(); }