Hi, I am using Spock Framework to perform Unit Testing of Camel Routes. My first route consumes from Kafka Consumer Endpoint. I need to mock this end point and send the message to mock endpoint as part of the unit testing, below is how I have tried
camelctx.getRouteDefinitions().get(0).adviceWith(camelctx, new AdviceWithRouteBuilder() { @Override void configure() throws Exception { interceptSendToEndpoint("kafka:{{server}}?topic={{topic}}&zookeeperHost={{zookeeper}}&zookeeperPort={{zookeeperport}}&groupId={{group}}&autoCommitEnable=true&autoOffsetReset=smallest&autoCommitIntervalMs=1000") .skipSendToOriginalEndpoint() .to("mock:kafkaCon") } }) Here I get the error "java.lang.NullPointerException: Cannot invoke method getIn() on null object" . I have also tried camelctx.getRouteDefinitions().get(0).adviceWith(camelctx, new AdviceWithRouteBuilder() { @Override void configure() throws Exception { replaceFromWith("mock:kafkaCon") } }) I get the error "java.lang.UnsupportedOperationException: You cannot consume from this endpoint" Any suggession on how to Mock the Kafka Consumer endpoint and advise if I am trying to do it wrong.. -Ganga -- View this message in context: http://camel.465427.n5.nabble.com/How-to-Mock-Kafka-Consumer-Endpoint-with-Spock-Framework-Unit-Test-cases-tp5783856.html Sent from the Camel - Users mailing list archive at Nabble.com.