CntManagerImpl implements CntManager { @SuppressWarnings({"unchecked"}) @Override public Map<String, Map<String, Long>> getAllCounters() { Map<String, Map<String, Long>> map = new ConcurrentHashMap<>(); for (String e : classCounters.keySet()) { try { map.put(e, getCounters((Class<? extends Countable>) Class.forName(e))); } catch (ClassNotFoundException e1) { throw new IllegalStateException(e1); } } for (String e : strCnts.keySet()) { map.put(e, getCounters(e)); } return map; }  @Override void i(Countable e); @Override void i(Countable e, long val); @Override void i(String group, String name); @Override void i(String group, String name, long val); @Override long cnt(Countable e); @Override long cnt(String group, String name); @Override Counter getCounter(Countable e); @Override Counter getCounter(String group, String name); @Override Map<String, Long> getCounters(Class<? extends Countable> countableClass); @Override Map<String, Long> getCounters(String group); @SuppressWarnings({"unchecked"}) @Override Map<String, Map<String, Long>> getAllCounters(); @Override Map<String, Long> flattenAllCounters(String separator); @Override synchronized void addMetric(String name, CntsMetric cntsMetric); @Override synchronized void removeMetric(String name); @Override synchronized String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testGetAllCounters() throws Exception { target.i(TaggingLabels.ITEM); target.i(TaggingLabels.OTHER); final Map<String, Map<String, Long>> allCounters = target.getAllCounters(); assertThat(allCounters.size(), is(1)); final Map<String, Long> stringLongMap = allCounters.get("org.grobid.core.engines.label.TaggingLabelImpl"); assertThat(stringLongMap.size(), is(2)); assertThat(stringLongMap.get(TaggingLabels.OTHER.getName()), is(1l)); assertThat(stringLongMap.get(TaggingLabels.ITEM.getName()), is(1l)); }