Search in sources :

Example 1 with Foo

use of org.apache.camel.test.blueprint.Foo in project camel by apache.

the class CustomConverterTest method testCustomConverter.

@Test
public void testCustomConverter() throws Exception {
    getMockEndpoint("mock:result").expectedMessageCount(1);
    getMockEndpoint("mock:result").message(0).body().isInstanceOf(Foo.class);
    template.sendBody("direct:start", "John,Doe");
    assertMockEndpointsSatisfied();
    Foo foo = getMockEndpoint("mock:result").getReceivedExchanges().get(0).getIn().getBody(Foo.class);
    assertEquals("John", foo.getFirst());
    assertEquals("Doe", foo.getLast());
}
Also used : Foo(org.apache.camel.test.blueprint.Foo) Test(org.junit.Test)

Example 2 with Foo

use of org.apache.camel.test.blueprint.Foo in project camel by apache.

the class FooConverter method convertToFoo.

@Converter
public Foo convertToFoo(String data) {
    String[] s = data.split(",");
    Foo foo = new Foo();
    foo.setFirst(s[0]);
    foo.setLast(s[1]);
    return foo;
}
Also used : Foo(org.apache.camel.test.blueprint.Foo) Converter(org.apache.camel.Converter)

Aggregations

Foo (org.apache.camel.test.blueprint.Foo)2 Converter (org.apache.camel.Converter)1 Test (org.junit.Test)1