CommandApiSuspender implements Suspendable { @Override public SuspensionResult unsuspend(final UUID commandId, final SuspensionCommand suspensionCommand) { logger.info("Unsuspending Command API"); commandApiSuspensionBean.unsuspend(); logger.info("Unsuspension of Command API complete"); return suspensionSucceeded( getName(), commandId, "Command API unsuspended with no errors", suspensionCommand ); }  @Override boolean shouldSuspend(); @Override boolean shouldUnsuspend(); @Override SuspensionResult suspend(final UUID commandId, final SuspensionCommand suspensionCommand); @Override SuspensionResult unsuspend(final UUID commandId, final SuspensionCommand suspensionCommand);  }
@Test public void shouldCallCommandApiSuspensionBeanAndUnsuspend() throws Exception { final UUID commandId = randomUUID(); final SuspensionCommand suspensionCommand = mock(SuspensionCommand.class); final SuspensionResult suspensionResult = commandApiSuspender.unsuspend(commandId, suspensionCommand); assertThat(suspensionResult.getCommandId(), is(commandId)); assertThat(suspensionResult.getCommandState(), is(COMMAND_COMPLETE)); assertThat(suspensionResult.getSystemCommand(), is(suspensionCommand)); assertThat(suspensionResult.getMessage(), is("Command API unsuspended with no errors")); assertThat(suspensionResult.getSuspendableName(), is("CommandApiSuspender")); assertThat(suspensionResult.getException(), is(empty())); final InOrder inOrder = inOrder(logger, commandApiSuspensionBean); inOrder.verify(logger).info("Unsuspending Command API"); inOrder.verify(commandApiSuspensionBean).unsuspend(); inOrder.verify(logger).info("Unsuspension of Command API complete"); }