@Test
public void testTracer() throws Exception {

    JsonMarshaller marshaller = new JsonMarshaller();
    MockEventAdmin eventAdmin = new MockEventAdmin();
    DecanterTraceEventHandler handler = new DecanterTraceEventHandler();
    handler.setEventAdmin(eventAdmin);
    DefaultCamelContext camelContext = createCamelContext(handler);
    ProducerTemplate template = camelContext.createProducerTemplate();
    template.sendBodyAndHeader("direct:start", "TEST", "header", "test");
    for (Event event : eventAdmin.getPostEvents()) {
        String jsonString = marshaller.marshal(event);
        JsonReader jsonReader = Json.createReader(new StringReader(jsonString));
        JsonObject rootObject = jsonReader.readObject();
        System.out.println(jsonString);
        Assert.assertEquals("InOnly", rootObject.getString("exchangePattern"));
        Assert.assertEquals("camelTracer", rootObject.getString("type"));
        Assert.assertEquals("test-route", rootObject.getString("routeId"));
        Assert.assertEquals("test-context", rootObject.getString("camelContextName"));
        JsonObject headersObject = rootObject.getJsonObject("inHeaders");
        Assert.assertEquals("test", headersObject.getString("header"));
        Assert.assertEquals("direct://start", rootObject.getString("fromEndpointUri"));
        Assert.assertEquals("TEST", rootObject.getString("inBody"));
        JsonObject propertiesObject = rootObject.getJsonObject("properties");
        Assert.assertEquals("log://foo", propertiesObject.getString("CamelToEndpoint"));
        Assert.assertEquals("String", rootObject.getString("inBodyType"));
        Assert.assertEquals("decanter/collect/camel/tracer", rootObject.getString("event_topics"));
        System.out.println(marshaller.marshal(event));
    }
}