- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {Charset c =
String charsetName;Charset.forName(charsetName)
Charset.defaultCharset()
ContentType contentType;contentType.getCharset()
- Smart code suggestions by Codota
}
@DataProvider(value = { "true", "false" }) @Test public void doChannelInactive_completes_metrics_if_necessary_and_HttpProcessingState_is_not_null( boolean stateIsNull ) throws Exception { // given ChannelPipelineFinalizerHandler handlerSpy = spy(handler); if (stateIsNull) { doReturn(null).when(stateAttributeMock).get(); } // when PipelineContinuationBehavior result = handlerSpy.doChannelInactive(ctxMock); // then if (stateIsNull) { verify(handlerSpy, never()).handleMetricsForCompletedRequestIfNotAlreadyDone(any(HttpProcessingState.class)); } else { verify(handlerSpy).handleMetricsForCompletedRequestIfNotAlreadyDone(state); } }
@Test public void handleMetricsForCompletedRequestIfNotAlreadyDone_does_not_propagate_unexpected_exceptions() { // given HttpProcessingState stateMock = mock(HttpProcessingState.class); doThrow(new RuntimeException("intentional exception")).when(stateMock).isRequestMetricsRecordedOrScheduled(); // when Throwable ex = catchThrowable(() -> handler.handleMetricsForCompletedRequestIfNotAlreadyDone(stateMock)); // then Assertions.assertThat(ex).isNull(); verify(stateMock).isRequestMetricsRecordedOrScheduled(); }