use of com.signalfx.metrics.auth.AuthToken in project riposte by Nike-Inc.
the class SignalFxReporterFactoryTest method getReporter_passes_properly_configured_builder_to_reporterConfigurator_and_builds_the_result_of_reporterConfigurator.
@Test
public void getReporter_passes_properly_configured_builder_to_reporterConfigurator_and_builds_the_result_of_reporterConfigurator() {
// when
SignalFxReporter result = factory.getReporter(metricRegistryMock);
// then
// Make sure the configurator function received a properly configured builder.
ArgumentCaptor<Builder> origBuilderArgCaptor = ArgumentCaptor.forClass(Builder.class);
verify(configuratorMock).apply(origBuilderArgCaptor.capture());
Builder origBuilder = origBuilderArgCaptor.getValue();
assertThat(getInternalState(origBuilder, "registry")).isSameAs(metricRegistryMock);
assertThat(((AuthToken) getInternalState(origBuilder, "authToken")).getAuthToken()).isEqualTo(apiKey);
// Make sure the thing returned by the configurator was used to build the final reporter.
assertThat(((Map<String, DimensionInclusion>) getInternalState(result, "defaultDimensions")).get(customDimKey).getValue()).isEqualTo(customDimValue);
}
Aggregations