### Question:
StoreFileStreamingProtocol { Future<Void> end( ChannelHandlerContext ctx, StoreCopyFinishedResponse.Status status ) { ctx.write( ResponseMessageType.STORE_COPY_FINISHED ); return ctx.writeAndFlush( new StoreCopyFinishedResponse( status ) ); }    }### Answer:
@Test public void shouldBeAbleToEndWithFailure() { StoreFileStreamingProtocol protocol = new StoreFileStreamingProtocol(); ChannelHandlerContext ctx = mock( ChannelHandlerContext.class ); protocol.end( ctx, E_STORE_ID_MISMATCH ); InOrder inOrder = Mockito.inOrder( ctx ); inOrder.verify( ctx ).write( ResponseMessageType.STORE_COPY_FINISHED ); inOrder.verify( ctx ).writeAndFlush( new StoreCopyFinishedResponse( E_STORE_ID_MISMATCH ) ); inOrder.verifyNoMoreInteractions(); }
@Test public void shouldBeAbleToEndWithSuccess() { StoreFileStreamingProtocol protocol = new StoreFileStreamingProtocol(); ChannelHandlerContext ctx = mock( ChannelHandlerContext.class ); protocol.end( ctx, StoreCopyFinishedResponse.Status.SUCCESS ); InOrder inOrder = Mockito.inOrder( ctx ); inOrder.verify( ctx ).write( ResponseMessageType.STORE_COPY_FINISHED ); inOrder.verify( ctx ).writeAndFlush( new StoreCopyFinishedResponse( SUCCESS ) ); inOrder.verifyNoMoreInteractions(); }