CountersToReportEntriesConverter { public List<ReportEntry> convertToReportEntries(NamedCounters counters) { List<ReportEntry> reportEntries = Lists.newArrayList(); for (String counterName : counters.counterNames()) { ReportEntry reportEntry = ReportEntryFactory.createCounterReportEntry(mapToReportEntryKey(counterName), counters.currentValue(counterName)); reportEntries.add(reportEntry); } return reportEntries; } CountersToReportEntriesConverter(Map<String, String> counterNameToEntryKeyMapping); List<ReportEntry> convertToReportEntries(NamedCounters counters);  }
@Test public void convert() { NamedCounters namedCounters = new NamedCounters(new String[] {counterName1, counterName2, counterName3}); namedCounters.increment(counterName1, 3L); namedCounters.increment(counterName2, 4L); namedCounters.increment(counterName3, 5L); List<ReportEntry> reportEntries = converter.convertToReportEntries(namedCounters); assertThat(reportEntries, containsInAnyOrder( new ReportEntry(reportEntryKey1, ReportEntryType.COUNTER, "3"), new ReportEntry(reportEntryKey2, ReportEntryType.COUNTER, "4"), new ReportEntry(counterName3, ReportEntryType.COUNTER, "5"))); }