@SuppressWarnings({"unchecked"}) @Test void testSendWithoutCallback() throws ExecutionException, InterruptedException { doAnswer(invocation -> { ((CommandCallback<Object, Object>) invocation.getArguments()[1]).onResult( (CommandMessage<Object>) invocation.getArguments()[0], asCommandResultMessage("returnValue") ); return null; }).when(mockCommandBus).dispatch(isA(CommandMessage.class), isA(CommandCallback.class)); CompletableFuture<?> future = testSubject.send("Command"); assertTrue(future.isDone()); assertEquals("returnValue", future.get()); }
@Override public <C, R> void send(C command, CommandCallback<? super C, ? super R> callback) { super.send(command, callback); }
DefaultCommandGateway extends AbstractCommandGateway implements CommandGateway { @Override public <C, R> void send(C command, CommandCallback<? super C, ? super R> callback) { super.send(command, callback); } }
DefaultCommandGateway extends AbstractCommandGateway implements CommandGateway { @Override public <C, R> void send(C command, CommandCallback<? super C, ? super R> callback) { super.send(command, callback); } protected  DefaultCommandGateway(Builder builder); }
DefaultCommandGateway extends AbstractCommandGateway implements CommandGateway { @Override public <C, R> void send(C command, CommandCallback<? super C, ? super R> callback) { super.send(command, callback); } protected  DefaultCommandGateway(Builder builder); static Builder builder(); @Override void send(C command, CommandCallback<? super C, ? super R> callback); @Override @SuppressWarnings("unchecked") R sendAndWait(Object command); @Override @SuppressWarnings("unchecked") R sendAndWait(Object command, long timeout, TimeUnit unit); @Override CompletableFuture<R> send(Object command); @Override Registration registerDispatchInterceptor(
            MessageDispatchInterceptor<? super CommandMessage<?>> dispatchInterceptor); }
DefaultCommandGateway extends AbstractCommandGateway implements CommandGateway { @Override public <C, R> void send(C command, CommandCallback<? super C, ? super R> callback) { super.send(command, callback); } protected  DefaultCommandGateway(Builder builder); static Builder builder(); @Override void send(C command, CommandCallback<? super C, ? super R> callback); @Override @SuppressWarnings("unchecked") R sendAndWait(Object command); @Override @SuppressWarnings("unchecked") R sendAndWait(Object command, long timeout, TimeUnit unit); @Override CompletableFuture<R> send(Object command); @Override Registration registerDispatchInterceptor(
            MessageDispatchInterceptor<? super CommandMessage<?>> dispatchInterceptor);  }