@Autowired
PollableChannel javaLegQuoteCommands;
@Test
public void splitterShouldSplitIntoSubcommands() {
CreateTripCommand tripCommand = mock(CreateTripCommand.class);
Message<CreateTripCommand> tripCommandMessage = MessageBuilder.withPayload(tripCommand).build();
final Command carCommand = mock(Command.class);
final Command flightCommand = mock(Command.class);
final Command hotelCommand = mock(Command.class);
given(tripCommand.getSubCommands()).willReturn(Arrays.asList(carCommand, flightCommand, hotelCommand));
tripCommands.send(tripCommandMessage);
List<Message<? extends Object>> received =
Arrays.asList(javaLegQuoteCommands.receive(100), javaLegQuoteCommands.receive(100), javaLegQuoteCommands.receive(100));
assertThat(received.size(), is(3));