Apache Camel 测试 expectedBodiesReceived 检查正文是否为空?

Apache Camel test expectedBodiesReceived check if the body is null?

我有一个处理器使用消息并将正文设置为空的路由。

public class KafkaRedirect implements Processor {
    @Override
    public void process(final Exchange exchange) throws Exception {

        ... some logic to send to another party

        /**
        * This is added   to consume the message
        */
        exchange.getIn().setBody(null);         
    }
}

在测试中我向路由发送消息,我想测试消息是否已发送并且正文是否为空。

    @Test
    public void testMyRoute() throws Exception {
        final MockEndpoint thirdPartyEndpoin = getMandatoryEndpoint("mock://myRoute", MockEndpoint.class);
        context().getRouteDefinition("myRouteId")
            .adviceWith(context(), new AdviceWithRouteBuilder() {

                @Override
                public void configure() throws Exception {
                    weaveById("myProcessId").after().to(thirdPartyEndpoin);
                }
            });

        startCamelContext();

        thirdPartyEndpoin.expectedMessageCount(1);

        /* I NEED TO TEST IF THE BODY IS NULL*/
        thirdPartyEndpoin.expectedBodiesReceived(null);

        template.sendBody(ROUTE_DIRECT_START, "{\"foo\":\"foo\"}");
        thirdPartyEndpoin.assertIsSatisfied(TimeUnit.SECONDS.toMillis(EXPECTED_TIMEOUT_SECONDS));
    }

尝试类似的东西(从我的头顶输入)

thirdPartyEndpoin.message(0).body().isNull();