@Test
public void shouldFailIfMethodNotPublic() throws Exception {

    final TestCommandHandler testCommandHandler = new TestCommandHandler();
    final Method invalidPrivateHandlerMethod = getMethod("invalidPrivateHandlerMethod", testCommandHandler.getClass());
    try {
        handlerMethodValidator.checkHandlerMethodIsValid(invalidPrivateHandlerMethod, testCommandHandler);
        fail();
    } catch (final InvalidHandlerMethodException expected) {
        assertThat(expected.getMessage(), is("Handler method 'invalidPrivateHandlerMethod' on class 'uk.gov.justice.services.jmx.command.TestCommandHandler' is not public."));
    }
}