@Test public void registersDifferentMetricsSeparately() { Counter c1 = memoizing.createAndRegisterCounter(STRING_CLASS, METRIC_NAME, TABLE_REFERENCE); Counter c2 = memoizing.createAndRegisterCounter(STRING_CLASS, METRIC_NAME, TABLE_REFERENCE_2); assertThat(c1).isNotSameAs(c2); verify(delegate).createAndRegisterCounter(STRING_CLASS, METRIC_NAME, TABLE_REFERENCE); verify(delegate).createAndRegisterCounter(STRING_CLASS, METRIC_NAME, TABLE_REFERENCE_2); }
@Override public <T> Counter createAndRegisterCounter(Class<T> clazz, String metricName, TableReference tableReference) { return metricSpecCounterCache.get(MetricSpec.of(clazz, metricName, tableReference)); }
MemoizingTableLevelMetricsController implements TableLevelMetricsController { @Override public <T> Counter createAndRegisterCounter(Class<T> clazz, String metricName, TableReference tableReference) { return metricSpecCounterCache.get(MetricSpec.of(clazz, metricName, tableReference)); } }
MemoizingTableLevelMetricsController implements TableLevelMetricsController { @Override public <T> Counter createAndRegisterCounter(Class<T> clazz, String metricName, TableReference tableReference) { return metricSpecCounterCache.get(MetricSpec.of(clazz, metricName, tableReference)); } MemoizingTableLevelMetricsController(TableLevelMetricsController delegate); }
MemoizingTableLevelMetricsController implements TableLevelMetricsController { @Override public <T> Counter createAndRegisterCounter(Class<T> clazz, String metricName, TableReference tableReference) { return metricSpecCounterCache.get(MetricSpec.of(clazz, metricName, tableReference)); } MemoizingTableLevelMetricsController(TableLevelMetricsController delegate); @Override Counter createAndRegisterCounter(Class<T> clazz, String metricName, TableReference tableReference); }
MemoizingTableLevelMetricsController implements TableLevelMetricsController { @Override public <T> Counter createAndRegisterCounter(Class<T> clazz, String metricName, TableReference tableReference) { return metricSpecCounterCache.get(MetricSpec.of(clazz, metricName, tableReference)); } MemoizingTableLevelMetricsController(TableLevelMetricsController delegate); @Override Counter createAndRegisterCounter(Class<T> clazz, String metricName, TableReference tableReference);  }