InnerGlobalTxStepVisitor extends StepGlobalTxVisitor { void receivePayLoadGTX(GlobalTransactionStepDefinition<? extends BaseGlobalTransactionEvent> transactionPipeline, String gtx){ final AbstractTransactionStepDefinition.ReceivedCommandGTX receivedCommandGTX = transactionPipeline.getReceivedCommandGTX(); if(receivedCommandGTX != null) { Optional<Object> payload = getCommandOrchestrator().retreive(transactionPipeline.getIn().getId(), receivedCommandGTX.getTarget()); payload.ifPresent(p -> receivedCommandGTX.getConsumer().accept(gtx,p)); } } InnerGlobalTxStepVisitor(BubbleCache bubbleCache, ApplicationEventPublisher applicationEventPublisher,
                                    VisitorProvision provision, CommandOrchestrator commandOrchestrator, TransactionUtilities utilities); static InnerGlobalTxStepVisitorBuilder builder(); @Override void visit(GlobalTransactionStepDefinition<? extends BaseGlobalTransactionEvent> transactionPipeline);  }
@Test public void testReceivePayLoadGTX() { final GlobalTransactionStepDefinition transactionPipeline = mock(GlobalTransactionStepDefinition.class, RETURNS_DEEP_STUBS); final BiConsumer target = mock(BiConsumer.class); final String payload = "payload"; final String gtx = "gtx"; AbstractTransactionStepDefinition.ReceivedCommandGTX command = new AbstractTransactionStepDefinition.ReceivedCommandGTX(Object.class, target); when(transactionPipeline.getReceivedCommandGTX()).thenReturn(command); when(transactionPipeline.getIn().getId()).thenReturn("someid"); when(mockCommandOrchestrator.retreive(anyString(), any())).thenReturn(Optional.of(payload)); innerGlobalTxStepVisitorUnderTest.receivePayLoadGTX(transactionPipeline, gtx); verify(mockCommandOrchestrator).retreive("someid", Object.class); verify(target).accept(same(gtx), any()); }