@Test public void doChannelRead_returns_CONTINUE_when_response_is_not_chunked_and_msg_is_LastOutboundMessageSendFullResponseInfo() throws Exception { // expect assertThat(handler.doChannelRead(ctxMock, msg)).isEqualTo(CONTINUE); }
@Test public void doChannelRead_throws_InvalidRipostePipelineException_when_state_is_null() { // given doReturn(null).when(stateAttributeMock).get(); // when Throwable ex = catchThrowable(() -> handler.doChannelRead(ctxMock, msg)); // then assertThat(ex).isInstanceOf(InvalidRipostePipelineException.class); }
@Test public void doChannelRead_throws_InvalidRipostePipelineException_when_msg_is_not_OutboundMessage() { // when Throwable ex = catchThrowable(() -> handler.doChannelRead(ctxMock, new Object())); // then assertThat(ex).isInstanceOf(InvalidRipostePipelineException.class); }
@Test public void doChannelRead_returns_CONTINUE_when_response_is_chunked_and_msg_is_ChunkedOutboundMessage() throws Exception { // given doReturn(true).when(responseInfoMock).isChunkedResponse(); msg = mock(ChunkedOutboundMessage.class); // expect assertThat(handler.doChannelRead(ctxMock, msg)).isEqualTo(CONTINUE); }
@Test public void doChannelRead_throws_InvalidRipostePipelineException_when_msg_is_null() { // when Throwable ex = catchThrowable(() -> handler.doChannelRead(ctxMock, null)); // then assertThat(ex).isInstanceOf(InvalidRipostePipelineException.class); }
@Test public void doChannelRead_throws_InvalidRipostePipelineException_when_responseInfo_is_not_chunked_but_msg_is_not_LastOutboundMessageSendFullResponseInfo() { // given doReturn(false).when(responseInfoMock).isChunkedResponse(); msg = mock(ChunkedOutboundMessage.class); // when Throwable ex = catchThrowable(() -> handler.doChannelRead(ctxMock, msg)); // then assertThat(ex).isInstanceOf(InvalidRipostePipelineException.class); }
@Test public void doChannelRead_throws_InvalidRipostePipelineException_when_responseInfo_is_chunked_but_msg_is_not_ChunkedOutboundMessage() { // given doReturn(true).when(responseInfoMock).isChunkedResponse(); msg = mock(LastOutboundMessageSendFullResponseInfo.class); // when Throwable ex = catchThrowable(() -> handler.doChannelRead(ctxMock, msg)); // then assertThat(ex).isInstanceOf(InvalidRipostePipelineException.class); }
@Test public void doChannelRead_throws_InvalidRipostePipelineException_when_responseInfo_is_null() { // given state.setResponseInfo(null, null); // when Throwable ex = catchThrowable(() -> handler.doChannelRead(ctxMock, msg)); // then assertThat(ex).isInstanceOf(InvalidRipostePipelineException.class); }