private ChannelFutureListener logOnWriteErrorOperationListener(ChannelHandlerContext ctx) { Consumer<ChannelFuture> errorLoggerConsumerWithTracingAndMdc = consumerWithTracingAndMdc( logOnWriteErrorConsumer, ctx ); return channelFuture -> { if (!channelFuture.isSuccess()) errorLoggerConsumerWithTracingAndMdc.accept(channelFuture); }; }
private ChannelFutureListener logOnWriteErrorOperationListener(ChannelHandlerContext ctx) { Consumer<ChannelFuture> errorLoggerConsumerWithTracingAndMdc = consumerWithTracingAndMdc( logOnWriteErrorConsumer, ctx ); return channelFuture -> { if (!channelFuture.isSuccess()) errorLoggerConsumerWithTracingAndMdc.accept(channelFuture); }; }
@Test public void consumerWithTracingAndMdc_pair_works_as_expected() { // given Pair<Deque<Span>, Map<String, String>> setupInfo = generateTracingAndMdcInfo(); // when Consumer result = AsyncNettyHelper.consumerWithTracingAndMdc(consumerMock, setupInfo); // then verifyConsumerWithTracingAndMdcSupport(result, consumerMock, setupInfo.getLeft(), setupInfo.getRight()); }
@Test public void consumerWithTracingAndMdc_ctx_works_as_expected() { // given Pair<Deque<Span>, Map<String, String>> setupInfo = setupStateWithTracingAndMdcInfo(); // when Consumer result = AsyncNettyHelper.consumerWithTracingAndMdc(consumerMock, ctxMock); // then verifyConsumerWithTracingAndMdcSupport(result, consumerMock, setupInfo.getLeft(), setupInfo.getRight()); }
@Test public void consumerWithTracingAndMdc_separate_args_works_as_expected() { // given Pair<Deque<Span>, Map<String, String>> setupInfo = generateTracingAndMdcInfo(); // when Consumer result = AsyncNettyHelper.consumerWithTracingAndMdc(consumerMock, setupInfo.getLeft(), setupInfo.getRight()); // then verifyConsumerWithTracingAndMdcSupport(result, consumerMock, setupInfo.getLeft(), setupInfo.getRight()); }