@Test
 public void testXsltWithImports() throws Exception {
   Resource resource = new ClassPathResource("transform-with-import.xsl", this.getClass());
   transformer = new XsltPayloadTransformer(resource);
   transformer.afterPropertiesSet();
   assertEquals(transformer.doTransform(buildMessage(docAsString)), outputAsString);
 }
 @Test
 public void testSourceWithResultTransformer() throws Exception {
   Integer returnValue = new Integer(13);
   transformer =
       new XsltPayloadTransformer(getXslResource(), new StubResultTransformer(returnValue));
   transformer.afterPropertiesSet();
   Object transformed = transformer.doTransform(buildMessage(new StringSource(docAsString)));
   assertEquals("Wrong value from result conversion", returnValue, transformed);
 }
 @Test
 public void docInStringOut() throws Exception {
   transformer = new XsltPayloadTransformer(getXslResourceThatOutputsText());
   transformer.setResultFactory(new StringResultFactory());
   transformer.setAlwaysUseResultFactory(true);
   transformer.afterPropertiesSet();
   Object returned =
       transformer.doTransform(buildMessage(XmlTestUtil.getDocumentForString(docAsString)));
   assertEquals("Wrong type of return ", StringResult.class, returned.getClass());
   assertEquals("Wrong content in string", "hello world", returned.toString());
 }
 @Test
 public void stringInDomResultOut() throws Exception {
   Resource resource = new ClassPathResource("transform-with-import.xsl", this.getClass());
   transformer = new XsltPayloadTransformer(resource);
   transformer.setResultFactory(new StringResultFactory());
   transformer.setAlwaysUseResultFactory(true);
   transformer.afterPropertiesSet();
   Object returned =
       transformer.doTransform(buildMessage(XmlTestUtil.getDocumentForString(docAsString)));
   assertEquals("Wrong type of return ", StringResult.class, returned.getClass());
 }
 @Test
 public void testXsltPayloadWithTransformerFactoryClassname() throws Exception {
   Integer returnValue = new Integer(13);
   transformer =
       new XsltPayloadTransformer(
           getXslResource(),
           new StubResultTransformer(returnValue),
           "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
   transformer.afterPropertiesSet();
   Object transformed = transformer.doTransform(buildMessage(new StringSource(docAsString)));
   assertEquals("Wrong value from result conversion", returnValue, transformed);
 }
 @Before
 public void setUp() throws Exception {
   transformer = new XsltPayloadTransformer(getXslResource());
   transformer.afterPropertiesSet();
 }
 @Test(expected = TransformerFactoryConfigurationError.class)
 public void testXsltPayloadWithBadTransformerFactoryClassname() throws Exception {
   transformer = new XsltPayloadTransformer(getXslResource(), "foo.bar.Baz");
   transformer.afterPropertiesSet();
   transformer.doTransform(buildMessage(new StringSource(docAsString)));
 }