use of com.nike.riposte.server.metrics.ServerMetricsEvent in project riposte by Nike-Inc.
the class CodahaleMetricsListenerTest method onEvent_gracefully_handles_thrown_exceptions.
@Test
public void onEvent_gracefully_handles_thrown_exceptions() {
// given
ServerMetricsEvent event = ServerMetricsEvent.RESPONSE_SENT;
RuntimeException ex = new RuntimeException("kaboom");
doThrow(ex).when(listener.inflightRequests).dec();
Logger loggerMock = mock(Logger.class);
doReturn(false).when(loggerMock).isDebugEnabled();
Whitebox.setInternalState(listener, "logger", loggerMock);
// when
listener.onEvent(event, state);
// then
// Should have blown up before the processedRequests stuff.
verifyZeroInteractions(listener.processedRequests);
verify(loggerMock).error("Metrics Error: ", ex);
}
Aggregations