DefaultCamelContext camelContext = new DefaultCamelContext();
CamelDestination dest = EasyMock.createMock(CamelDestination.class);
dest.incoming(EasyMock.isA(org.apache.camel.Exchange.class));
EasyMock.expectLastCall().andThrow(expectedException);
EasyMock.replay(dest);
ConsumerProcessor consumerProcessor = dest.new ConsumerProcessor();
// Send our dummy exchange and check that the exception that occurred on incoming is set
DefaultExchange exchange = new DefaultExchange(camelContext);
consumerProcessor.process(exchange);
Exception exc = exchange.getException();
Assert.assertNotNull(exc);
Assert.assertEquals(expectedException, exc);
EasyMock.verify(dest);
}