use of com.nike.riposte.metrics.codahale.impl.SignalFxEndpointMetricsHandler.ChainedMetricDimensionConfigurator in project riposte by Nike-Inc.
the class SignalFxEndpointMetricsHandlerTest method ChainedMetricDimensionConfigurator_constructor_sets_fields_as_expected.
@Test
public void ChainedMetricDimensionConfigurator_constructor_sets_fields_as_expected() {
// given
MetricDimensionConfigurator first = mock(MetricDimensionConfigurator.class);
MetricDimensionConfigurator second = mock(MetricDimensionConfigurator.class);
// when
ChainedMetricDimensionConfigurator instance = new ChainedMetricDimensionConfigurator(first, second);
// then
assertThat(instance.firstConfigurator).isSameAs(first);
assertThat(instance.secondConfigurator).isSameAs(second);
}
use of com.nike.riposte.metrics.codahale.impl.SignalFxEndpointMetricsHandler.ChainedMetricDimensionConfigurator in project riposte by Nike-Inc.
the class SignalFxEndpointMetricsHandlerTest method MetricDimensionConfigurator_chainedWith_returns_ChainedMetricDimensionConfigurator_with_correct_args.
@Test
public void MetricDimensionConfigurator_chainedWith_returns_ChainedMetricDimensionConfigurator_with_correct_args() {
// given
MetricDimensionConfigurator orig = (rawBuilder, requestInfo, responseInfo, httpState, responseHttpStatusCode, responseHttpStatusCodeXXValue, elapsedTimeMillis, endpoint, endpointClass, method, matchingPathTemplate) -> null;
MetricDimensionConfigurator chainMe = mock(MetricDimensionConfigurator.class);
// when
MetricDimensionConfigurator result = orig.chainedWith(chainMe);
// then
assertThat(result).isInstanceOf(ChainedMetricDimensionConfigurator.class);
ChainedMetricDimensionConfigurator cmdc = (ChainedMetricDimensionConfigurator) result;
assertThat(cmdc.firstConfigurator).isSameAs(orig);
assertThat(cmdc.secondConfigurator).isSameAs(chainMe);
}
use of com.nike.riposte.metrics.codahale.impl.SignalFxEndpointMetricsHandler.ChainedMetricDimensionConfigurator in project riposte by Nike-Inc.
the class SignalFxEndpointMetricsHandlerTest method ChainedMetricDimensionConfigurator_setupMetricWithDimensions_chains_calls_as_expected.
@Test
public void ChainedMetricDimensionConfigurator_setupMetricWithDimensions_chains_calls_as_expected() {
// given
MetricDimensionConfigurator first = mock(MetricDimensionConfigurator.class);
MetricDimensionConfigurator second = mock(MetricDimensionConfigurator.class);
ChainedMetricDimensionConfigurator instance = new ChainedMetricDimensionConfigurator(first, second);
int responseStatusCode = 242;
int responseStatusCodeXXValue = 2;
long elapsedTimeMillis = 42;
String endpointClass = UUID.randomUUID().toString();
String method = UUID.randomUUID().toString();
BuilderTagger origBuilderMock = mock(BuilderTagger.class);
BuilderTagger firstResultBuilderMock = mock(BuilderTagger.class);
BuilderTagger secondResultBuilderMock = mock(BuilderTagger.class);
doReturn(firstResultBuilderMock).when(first).setupMetricWithDimensions(any(BuilderTagger.class), any(RequestInfo.class), any(ResponseInfo.class), any(HttpProcessingState.class), anyInt(), anyInt(), anyLong(), any(Endpoint.class), anyString(), anyString(), anyString());
doReturn(secondResultBuilderMock).when(second).setupMetricWithDimensions(any(BuilderTagger.class), any(RequestInfo.class), any(ResponseInfo.class), any(HttpProcessingState.class), anyInt(), anyInt(), anyLong(), any(Endpoint.class), anyString(), anyString(), anyString());
// when
BuilderTagger finalResult = instance.setupMetricWithDimensions(origBuilderMock, requestInfoMock, responseInfoMock, httpStateMock, responseStatusCode, responseStatusCodeXXValue, elapsedTimeMillis, endpointMock, endpointClass, method, matchingPathTemplate);
// then
verify(first).setupMetricWithDimensions(origBuilderMock, requestInfoMock, responseInfoMock, httpStateMock, responseStatusCode, responseStatusCodeXXValue, elapsedTimeMillis, endpointMock, endpointClass, method, matchingPathTemplate);
verify(second).setupMetricWithDimensions(firstResultBuilderMock, requestInfoMock, responseInfoMock, httpStateMock, responseStatusCode, responseStatusCodeXXValue, elapsedTimeMillis, endpointMock, endpointClass, method, matchingPathTemplate);
assertThat(finalResult).isSameAs(secondResultBuilderMock);
}
Aggregations