MessageContentUtil { public static void abortChain( Message message, Throwable ex ) { if ( ex.getClass() == AccessControlException.class ) { abortChain( message, 403, "Access Denied to the resource" ); } else if ( ex.getClass() == LoginException.class ) { abortChain( message, 401, "User is not authorized" ); } else { abortChain( message, 500, "Internal system Error 500" ); } LOG.error( "****** Error !!! Error in AccessInterceptor:" + ex.toString(), ex ); } private  MessageContentUtil(); static void abortChain( Message message, Throwable ex ); static void abortChain( Message message, int errorStatus, String errorMessage ); static void decryptContent( SecurityManager securityManager, Message message, String hostIdSource,
                                       String hostIdTarget ); static void encryptContent( SecurityManager securityManager, String hostIdSource, String hostIdTarget,
                                       Message message );  }
@Test public void testAbortChain() throws Exception { MessageContentUtil.abortChain( message, new AccessControlException( "" ) ); verify( response ).setStatus( 403 ); MessageContentUtil.abortChain( message, new LoginException( "" ) ); verify( response ).setStatus( 401 ); MessageContentUtil.abortChain( message, new RuntimeException( "" ) ); verify( response ).setStatus( 500 ); verify( interceptors, atLeastOnce() ).abort(); }