@Test
public void shouldRunTheSystemCommandAsynchronously() throws Exception {

    final ZonedDateTime now = new UtcClock().now();
    final SystemCommand systemCommand = new TestCommand();
    when(clock.now()).thenReturn(now);
    final UUID commandId = asynchronousCommandRunner.run(systemCommand);
    final InOrder inOrder = inOrder(systemCommandStateBean, managedExecutorService);
    inOrder.verify(systemCommandStateBean).addSystemCommandState(systemCommandStatusCaptor.capture());
    inOrder.verify(managedExecutorService).submit(runSystemCommandTaskCaptor.capture());
    final SystemCommandStatus systemCommandStatus = systemCommandStatusCaptor.getValue();
    assertThat(systemCommandStatus.getSystemCommandName(), is(systemCommand.getName()));
    assertThat(systemCommandStatus.getStatusChangedAt(), is(now));
    assertThat(systemCommandStatus.getCommandState(), is(COMMAND_RECEIVED));
    assertThat(systemCommandStatus.getCommandId(), is(commandId));
    assertThat(systemCommandStatus.getMessage(), is("System Command TEST_COMMAND Received"));
    final RunSystemCommandTask runSystemCommandTask = runSystemCommandTaskCaptor.getValue();
    assertThat(getValueOfField(runSystemCommandTask, "systemCommandRunner", SystemCommandRunner.class), is(systemCommandRunner));
    assertThat(getValueOfField(runSystemCommandTask, "systemCommand", SystemCommand.class), is(systemCommand));
    assertThat(getValueOfField(runSystemCommandTask, "commandId", UUID.class), is(commandId));
}