GatewaySenderOverflowMonitor extends MBeanStatsMonitor { @Override public Number getStatistic(String name) { if (name.equals(StatsKey.GATEWAYSENDER_LRU_EVICTIONS)) { return getLruEvictions(); } if (name.equals(StatsKey.GATEWAYSENDER_ENTRIES_OVERFLOWED_TO_DISK)) { return getEntriesOverflowedToDisk(); } if (name.equals(StatsKey.GATEWAYSENDER_BYTES_OVERFLOWED_TO_DISK)) { return getBytesOverflowedToDisk(); } return 0; } GatewaySenderOverflowMonitor(String name); long getBytesOverflowedToDisk(); long getEntriesOverflowedToDisk(); @Override Number getStatistic(String name); @Override void addStatisticsToMonitor(Statistics stats); @Override void stopListener(); @Override void removeStatisticsFromMonitor(Statistics stats);  }
@Test public void getStatisticShouldReturnZeroForUnknownStatistics() { assertThat(gatewaySenderOverflowMonitor.getStatistic("unhandledStatistic")).isEqualTo(0); }