PayloadTransformingInterceptor extends TransformerObjectSupport implements EndpointInterceptor, InitializingBean { @Override public void afterPropertiesSet() throws Exception { if (requestXslt == null && responseXslt == null) { throw new IllegalArgumentException("Setting either 'requestXslt' or 'responseXslt' is required"); } TransformerFactory transformerFactory = getTransformerFactory(); XMLReader xmlReader = XMLReaderFactory.createXMLReader(); xmlReader.setFeature("http: if (requestXslt != null) { Assert.isTrue(requestXslt.exists(), "requestXslt \"" + requestXslt + "\" does not exit"); if (logger.isInfoEnabled()) { logger.info("Transforming request using " + requestXslt); } Source requestSource = new ResourceSource(xmlReader, requestXslt); requestTemplates = transformerFactory.newTemplates(requestSource); } if (responseXslt != null) { Assert.isTrue(responseXslt.exists(), "responseXslt \"" + responseXslt + "\" does not exit"); if (logger.isInfoEnabled()) { logger.info("Transforming response using " + responseXslt); } Source responseSource = new ResourceSource(xmlReader, responseXslt); responseTemplates = transformerFactory.newTemplates(responseSource); } }  void setRequestXslt(Resource requestXslt); void setResponseXslt(Resource responseXslt); @Override boolean handleRequest(MessageContext messageContext, Object endpoint); @Override boolean handleResponse(MessageContext messageContext, Object endpoint); @Override boolean handleFault(MessageContext messageContext, Object endpoint); @Override void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex); @Override void afterPropertiesSet();  }
@Test public void testNoStylesheetsSet() throws Exception { try { interceptor.afterPropertiesSet(); Assert.fail("Should have thrown an Exception"); } catch (IllegalArgumentException ex) {} }