### Question:
CamelotProcessor extends PluggableProcessor { @Override public Object dispatchMessage(Object processor, Object event, Map<String, Object> headers) throws DispatchException { try { return super.dispatchMessage(processor, event, headers); } catch (DispatchException e) { final AnnotatedMethodDispatcher caller = new AnnotatedMethodDispatcher(processor, getMeta(procClass)); final Map<Method, Object> called; try { final Throwable cause = (e.getCause() instanceof CallException) ? e.getCause().getCause() : e.getCause(); called = caller.dispatch(OnException.class, true, cause, event); if (!called.isEmpty() && called.size() == 1) { Method m = called.keySet().iterator().next(); Object result = called.values().iterator().next(); if (m.getAnnotation(OnException.class).preserve()) { return result; } } throw e; } catch (Exception failbackE) { logger.error("Failed to invoke @OnException on processor {} ", processor, failbackE); } logger.warn("Failed to dispatch message {} using processor {}: {}! \n {}", event, processor, e.getMessage(), formatStackTrace(e), e); } return null; } CamelotProcessor(ClassLoader classLoader, Class procClass, PluginContext context);  CamelotProcessor(ClassLoader classLoader, Class procClass, Object processor, PluginContext context); @Override void process(Exchange message); @Override Object dispatchMessage(Object processor, Object event, Map<String, Object> headers);  }### Answer:
@Test public void testProcessor() throws DispatchException { Proc prcMock = new Proc(); PluginContext context = new PluginContext(); context.setInjector(mock(PluginContextInjector.class)); CamelotProcessor proc = new CamelotProcessor(getClass().getClassLoader(), Proc.class, prcMock, context); final Map<String, Object> headers = Collections.emptyMap(); assertThat((String) proc.dispatchMessage(prcMock, "testEvent", headers), equalTo("testEvent")); assertThat(proc.dispatchMessage(prcMock, 10, headers), nullValue()); }