private void runInterceptorAndValidate( String document, Map<String, String> prefixes, List<XPathExpression> xpaths, boolean pass) throws Exception { final Document doc = this.readDocument(document); final SoapMessage msg = this.getSoapMessageForDom(doc); final CryptoCoverageChecker checker = new CryptoCoverageChecker(prefixes, xpaths); final PhaseInterceptor<SoapMessage> wss4jInInterceptor = this.getWss4jInInterceptor(); wss4jInInterceptor.handleMessage(msg); try { checker.handleMessage(msg); if (!pass) { fail("Passed interceptor erroneously."); } } catch (Fault e) { if (pass) { fail("Failed interceptor erroneously."); } assertTrue(e.getMessage().contains("element found matching XPath")); } }