@Test
public void shouldFailIfTheMethodIsInaccessible() throws Exception {

    final UUID commandId = UUID.randomUUID();
    final TestCommand testCommand = new TestCommand();
    final DummyHandler dummyHandler = new DummyHandler();
    final Method method = getMethod("aPrivateMethod", 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("Failed to call method 'aPrivateMethod()' on " + dummyHandler.getClass().getName() + ". Is the method public?"));
        assertThat(expected.getCause(), is(instanceOf(IllegalAccessException.class)));
    }
    verify(handlerMethodValidator).checkHandlerMethodIsValid(method, dummyHandler);
}