@Test void testPayloadExtractionProblemsReportedInException() throws ExecutionException, InterruptedException { doAnswer(i -> { CommandCallback<String, String> callback = i.getArgument(1); callback.onResult(i.getArgument(0), new GenericCommandResultMessage<String>("result") { private static final long serialVersionUID = -5443344481326465863L; @Override public String getPayload() { throw new MockException("Faking serialization problem"); } }); return null; }).when(mockCommandBus).dispatch(any(), any()); CompletableFuture<String> actual = testSubject.send("command"); assertTrue(actual.isDone()); assertTrue(actual.isCompletedExceptionally()); assertEquals("Faking serialization problem", actual.exceptionally(Throwable::getMessage).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);  }