@Test
public void shouldHandleSystemCommand() throws Exception {

    final UUID commandId = randomUUID();
    final TestCommand systemCommand = new TestCommand();
    final CommandState commandState = COMMAND_IN_PROGRESS;
    final ZonedDateTime statusChangedAt = new UtcClock().now();
    final String message = "message";
    final SystemCommandStateChangedEvent systemCommandStateChangedEvent = new SystemCommandStateChangedEvent(
            commandId,
            systemCommand,
            commandState,
            statusChangedAt,
            message
    );
    systemCommandStateHandler.handleSystemCommandStateChanged(systemCommandStateChangedEvent);
    verify(systemCommandStateBean).addSystemCommandState(systemCommandStatusCaptor.capture());
    final SystemCommandStatus systemCommandStatus = systemCommandStatusCaptor.getValue();
    assertThat(systemCommandStatus.getCommandId(), is(commandId));
    assertThat(systemCommandStatus.getSystemCommandName(), is(systemCommand.getName()));
    assertThat(systemCommandStatus.getCommandState(), is(commandState));
    assertThat(systemCommandStatus.getStatusChangedAt(), is(statusChangedAt));
    assertThat(systemCommandStatus.getMessage(), is(message));
}