@Test
public void shouldThrowAccessControlViolationExceptionIfAccessControlFailsForInput() throws Exception {

    final InterceptorContext inputContext = interceptorContextWithInput(envelope);
    inputContext.setInputParameter("component", "command");
    final AccessControlViolation accessControlViolation = new AccessControlViolation("reason");
    when(accessControlService.checkAccessControl("command", envelope)).thenReturn(Optional.of(accessControlViolation));
    when(accessControlFailureMessageGenerator.errorMessageFrom(envelope, accessControlViolation)).thenReturn("Error message");
    exception.expect(AccessControlViolationException.class);
    exception.expectMessage("Error message");
    interceptorChain.processNext(inputContext);
}