camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arnaud Vandyck <>
Subject Shouldn't MessageSupport.getBody(Class<T> type) throw an exception if the type is not the found
Date Mon, 02 Nov 2015 16:23:04 GMT

I added a test in org.apache.camel.impl.MessageSupportTest to reflect 
the actual situation:

public void testGetBodyNoTypeConversionAvailable() throws Exception {
         Exchange exchange = new DefaultExchange(context);
         Message in = exchange.getIn();
         final Country be = new Country();
         in.setBody(be, Country.class);

         assertNull("Should'n the body throws a 
NoTypeConversionAvailableException?", in.getBody(Integer.class));

The body is NOT null, but the convertor is not found. Shouldn't the 
getBody method throw a NoTypeConversionAvailableException to express the 
convertor has not been found?

Thanks for your comment,

Arnaud Vandyck

View raw message