MeteredConfigurationSource implements ConfigurationSource { @Override public void init() { Timer.Context context = initTimer.time(); try { delegate.init(); } finally { context.stop(); } } MeteredConfigurationSource(MetricRegistry metricRegistry, String metricPrefix, ConfigurationSource delegate); @Override Properties getConfiguration(Environment environment); @Override void init();  }
@Test void initCallsDelegate() { verify(delegate, times(1)).init(); }
@Test void initPropagatesIllegalStateExceptions() { doThrow(new IllegalStateException("")).when(delegate).init(); assertThatThrownBy(() -> delegate.init()).isExactlyInstanceOf(IllegalStateException.class); }
@Test void initPropagatesSourceCommunicationExceptions() { doThrow(new SourceCommunicationException("", null)).when(delegate).init(); assertThatThrownBy(() -> delegate.init()).isExactlyInstanceOf(SourceCommunicationException.class); }