@Test
public void shouldLogErrorAndReturnAFailureResult() throws Exception {

    final UUID commandId = UUID.randomUUID();
    final String suspendableName = "SuspendableName";
    final SuspensionCommand suspensionCommand = new UnsuspendCommand();
    final Suspendable suspendable = mock(Suspendable.class);
    final NullPointerException nullPointerException = new NullPointerException("Ooops");
    when(suspendable.getName()).thenReturn(suspendableName);
    final SuspensionResult suspensionResult = suspensionFailedHandler.onSuspensionFailed(
            commandId,
            suspensionCommand,
            suspendable,
            nullPointerException
    );
    assertThat(suspensionResult.getCommandId(), is(commandId));
    assertThat(suspensionResult.getCommandState(), is(COMMAND_FAILED));
    assertThat(suspensionResult.getMessage(), is("UNSUSPEND failed for SuspendableName. java.lang.NullPointerException: Ooops"));
    assertThat(suspensionResult.getSuspendableName(), is(suspendableName));
    assertThat(suspensionResult.getSystemCommand(), is(suspensionCommand));
    assertThat(suspensionResult.getException(), is(of(nullPointerException)));
    verify(logger).error("UNSUSPEND failed for SuspendableName. java.lang.NullPointerException: Ooops", nullPointerException);
}