I'm trying to do some unit tests on my type converters in what seems
like an obvious way:

public class MyObjectTest extends CamelTestSupport {
    public void testCamelSerialize() {
        Exchange exchange = new DefaultExchange(this.context);
        MyObject object = new MyObject();
        exchange.setIn(object.toMessage());
        assertEquals(object, exchange.getIn(MyObject.class);
    }
}

If I do this, it doesn't call my type converter method at all:

@Converter
public static MyObject fromMessage(Message message) {
    System.out.println("This message never shows up");
    // more stuff
}

Am I missing something about how this is supposed to work?

Reply via email to