MeteredConfigurationProvider implements ConfigurationProvider { @Override public <T> T getProperty(String key, Class<T> type) { Timer.Context context = getPropertyTimer.time(); try { return delegate.getProperty(key, type); } finally { context.stop(); } } MeteredConfigurationProvider(MetricRegistry metricRegistry, String metricPrefix, SimpleConfigurationProvider delegate); @Override Properties allConfigurationAsProperties(); @Override T getProperty(String key, Class<T> type); @Override T getProperty(String key, GenericTypeInterface genericType); @Override T bind(String prefix, Class<T> type);  }
@Test void getPropertyCallsDelegate() { when(delegate.getProperty("test.property", boolean.class)).thenReturn(true); assertThat(provider.getProperty("test.property", boolean.class)).isTrue(); }
@Test void getProperty2CallsDelegate() { @SuppressWarnings("Convert2Diamond") GenericType<List<String>> genericType = new GenericType<List<String>>() { }; when(delegate.getProperty(eq("test.property"), eq(genericType))).thenReturn(new LinkedList<>()); List<String> property = provider.getProperty("test.property", genericType); assertThat(property).isEmpty(); }