use of com.nike.riposte.metrics.codahale.impl.SignalFxEndpointMetricsHandler.RollingWindowTimerBuilder in project riposte by Nike-Inc.
the class SignalFxEndpointMetricsHandlerTest method three_arg_constructor_sets_fields_as_expected.
@Test
public void three_arg_constructor_sets_fields_as_expected() {
// given
SignalFxReporter reporterMock = mock(SignalFxReporter.class);
MetricMetadata expectedMetricMetadata = wireUpReporterForConstructor(reporterMock);
Pair<Long, TimeUnit> reportingFrequency = Pair.of(42L, TimeUnit.DAYS);
// when
SignalFxEndpointMetricsHandler instance = new SignalFxEndpointMetricsHandler(reporterMock, reportingFrequency, metricRegistryMock);
// then
assertThat(instance.metricMetadata).isSameAs(expectedMetricMetadata);
assertThat(instance.metricRegistry).isSameAs(metricRegistryMock);
assertThat(instance.requestTimerBuilder).isInstanceOf(RollingWindowTimerBuilder.class);
RollingWindowTimerBuilder rwtb = (RollingWindowTimerBuilder) instance.requestTimerBuilder;
assertThat(rwtb.amount).isEqualTo(reportingFrequency.getLeft());
assertThat(rwtb.timeUnit).isEqualTo(reportingFrequency.getRight());
assertThat(instance.requestTimerDimensionConfigurator).isSameAs(DEFAULT_REQUEST_LATENCY_TIMER_DIMENSION_CONFIGURATOR);
}
Aggregations