@Test
public void shouldFailIfPreviousSystemCommandIsInProgress() throws Exception {

    final TestCommand testCommand = new TestCommand();
    when(systemCommandLocator.forName(testCommand.getName())).thenReturn(of(testCommand));
    when(systemCommandStateBean.commandInProgress(testCommand)).thenReturn(true);
    try {
        systemCommander.call("TEST_COMMAND");
        fail();
    } catch (final UnrunnableSystemCommandException expected) {
        assertThat(expected.getMessage(), is("Cannot run system command 'TEST_COMMAND'. A previous call to that command is still in progress."));
    }
}