HandlerMethod { public boolean isDirect() { return handlerInstance.getClass().isAnnotationPresent(Direct.class); } HandlerMethod(final Object object, final Method method, final Class<?> expectedReturnType); @SuppressWarnings("unchecked") Envelope<T> execute(final Envelope<?> envelope); @Override String toString(); boolean isDirect(); Class<?> getPayloadType();  }
@Test public void shouldReturnFalseIfNoDirectAnnotation() throws Exception { final SynchronousCommandHandler handler = new SynchronousCommandHandler(); assertThat(new HandlerMethod(new SynchronousCommandHandler(), method(handler, "handles"), JsonEnvelope.class).isDirect(), is(false)); }
@Test public void shouldReturnTrueIfDirectAnnotationPresent() throws Exception { final TestDirectComponentAHandler handler = new TestDirectComponentAHandler(); assertThat(new HandlerMethod(handler, method(handler, "handles"), JsonEnvelope.class).isDirect(), is(true)); }