@Test
public void shouldLogAPingMessage() throws Exception {

    final UUID commandId = randomUUID();
    final PingCommand pingCommand = new PingCommand();
    final ZonedDateTime startedAt = of(2019, 11, 7, 15, 22, 25, 0, UTC);
    final ZonedDateTime completeAt = startedAt.plusSeconds(2);
    when(clock.now()).thenReturn(startedAt, completeAt);
    pingHandler.ping(pingCommand, commandId);
    final InOrder inOrder = inOrder(systemCommandStateChangedEventFirer, logger);
    inOrder.verify(systemCommandStateChangedEventFirer).fire(systemCommandStateChangedEventCaptor.capture());
    inOrder.verify(logger).info("********** Received system command 'PING' at 2019-11-07T15:22:25Z **********");
    inOrder.verify(systemCommandStateChangedEventFirer).fire(systemCommandStateChangedEventCaptor.capture());
    final List<SystemCommandStateChangedEvent> allValues = systemCommandStateChangedEventCaptor.getAllValues();
    final SystemCommandStateChangedEvent startEvent = allValues.get(0);
    final SystemCommandStateChangedEvent completeEvent = allValues.get(1);
    assertThat(startEvent.getCommandId(), is(commandId));
    assertThat(startEvent.getCommandState(), is(COMMAND_IN_PROGRESS));
    assertThat(startEvent.getSystemCommand(), is(pingCommand));
    assertThat(startEvent.getStatusChangedAt(), is(startedAt));
    assertThat(startEvent.getMessage(), is("Ping command received"));
    assertThat(completeEvent.getCommandId(), is(commandId));
    assertThat(completeEvent.getCommandState(), is(COMMAND_COMPLETE));
    assertThat(completeEvent.getSystemCommand(), is(pingCommand));
    assertThat(completeEvent.getStatusChangedAt(), is(completeAt));
    assertThat(completeEvent.getMessage(), is("Ping command complete"));
}