@Test @Timeout(value = 2) void testGatewayFireAndForget() { doAnswer(i -> { ((CommandCallback) i.getArguments()[1]).onResult((CommandMessage) i.getArguments()[0], asCommandResultMessage(null)); return null; }).when(mockCommandBus).dispatch(isA(CommandMessage.class), isA(CommandCallback.class)); testSubject.registerCommandCallback(callback, ResponseTypes.instanceOf(Void.class)); final Object metaTest = new Object(); gateway.fireAndForget("Command", null, metaTest, "value"); verify(mockCommandBus).dispatch(argThat(x -> x.getMetaData().get("test") == metaTest && "value".equals(x.getMetaData().get("key"))), isA(RetryingCallback.class)); verify(callback).onResult(isA(CommandMessage.class), any()); }
public <C, R> CommandGatewayFactory registerCommandCallback(CommandCallback<C, R> callback, ResponseType<R> responseType) { this.commandCallbacks.add(new TypeSafeCallbackWrapper<>(callback, responseType)); return this; }
CommandGatewayFactory { public <C, R> CommandGatewayFactory registerCommandCallback(CommandCallback<C, R> callback, ResponseType<R> responseType) { this.commandCallbacks.add(new TypeSafeCallbackWrapper<>(callback, responseType)); return this; } }
CommandGatewayFactory { public <C, R> CommandGatewayFactory registerCommandCallback(CommandCallback<C, R> callback, ResponseType<R> responseType) { this.commandCallbacks.add(new TypeSafeCallbackWrapper<>(callback, responseType)); return this; } protected  CommandGatewayFactory(Builder builder); }
CommandGatewayFactory { public <C, R> CommandGatewayFactory registerCommandCallback(CommandCallback<C, R> callback, ResponseType<R> responseType) { this.commandCallbacks.add(new TypeSafeCallbackWrapper<>(callback, responseType)); return this; } protected  CommandGatewayFactory(Builder builder); static Builder builder(); @SuppressWarnings("unchecked") T createGateway(Class<T> gatewayInterface); CommandGatewayFactory registerCommandCallback(CommandCallback<C, R> callback,
                                                                ResponseType<R> responseType); CommandGatewayFactory registerDispatchInterceptor(
            MessageDispatchInterceptor<CommandMessage<?>> dispatchInterceptor); }
CommandGatewayFactory { public <C, R> CommandGatewayFactory registerCommandCallback(CommandCallback<C, R> callback, ResponseType<R> responseType) { this.commandCallbacks.add(new TypeSafeCallbackWrapper<>(callback, responseType)); return this; } protected  CommandGatewayFactory(Builder builder); static Builder builder(); @SuppressWarnings("unchecked") T createGateway(Class<T> gatewayInterface); CommandGatewayFactory registerCommandCallback(CommandCallback<C, R> callback,
                                                                ResponseType<R> responseType); CommandGatewayFactory registerDispatchInterceptor(
            MessageDispatchInterceptor<CommandMessage<?>> dispatchInterceptor);  }