Hi, I try to create a test like this where I check if a specific exception type is generated but it does not work.
Is the code correct : @ContextConfiguration(locations = "org.apache.camel.dataformat.bindy.csv.BindySimpleCsvMandatoryFieldsUnmarshallTest$ContextConfig", loader = JavaConfigContextLoader.class) public class BindySimpleCsvMandatoryFieldsUnmarshallTest extends AbstractJUnit4SpringContextTests { String header = "order nr,client ref,first name, last name,instrument code,instrument name,order type, instrument type, quantity,currency,date\r\n"; String record1 = ",,,,,,,,,"; String record2 = ",,blabla,,,,,,"; @EndpointInject(uri = "mock:result") protected MockEndpoint resultEndpoint; @Produce(uri = "direct:start") protected ProducerTemplate template; @DirtiesContext @Test public void testEmptyFields() throws Exception { resultEndpoint.expectedMessageCount(0); try { template.sendBody(header + record1); } catch (IllegalArgumentException e) { // expected } resultEndpoint.assertIsSatisfied(); } @Configuration public static class ContextConfig extends SingleRouteCamelConfiguration { BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclassmandatory"); @Override @Bean public RouteBuilder route() { return new RouteBuilder() { @Override public void configure() { from("direct:start").unmarshal(camelDataFormat).to("mock:result"); } }; } } An IllegalArgumentException is generated in the log but the test testEmptyFields failed. Regards, Charles Moulliard Senior Enterprise Architect Apache Camel Committer ***************************** blog : http://cmoulliard.blogspot.com