@Test
public void shouldFailIfTheInvokedMethodThrowsAnException() throws Exception {

    final UUID commandId = UUID.randomUUID();
    final TestCommand testCommand = new TestCommand();
    final DummyHandler dummyHandler = new DummyHandler();
    final Method method = getMethod("anExceptionThrowingMethod", dummyHandler);
    final HandlerMethodValidator handlerMethodValidator = mock(HandlerMethodValidator.class);
    final SystemCommandHandlerProxy systemCommandHandlerProxy = new SystemCommandHandlerProxy(
            testCommand.getName(),
            method,
            dummyHandler,
            handlerMethodValidator);
    try {
        systemCommandHandlerProxy.invokeCommand(testCommand, commandId);
        fail();
    } catch (final SystemCommandInvocationException expected) {
        assertThat(expected.getMessage(), is("IOException thrown when calling method 'anExceptionThrowingMethod()' on " + dummyHandler.getClass().getName()));
        assertThat(expected.getCause(), is(instanceOf(IOException.class)));
    }
    verify(handlerMethodValidator).checkHandlerMethodIsValid(method, dummyHandler);
}