< prev index next >

test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java

Print this page

        

*** 23,63 **** package javax.xml.transform.ptests; import java.io.*; import java.io.FileOutputStream; import java.io.IOException; - import java.nio.file.Files; - import java.nio.file.Path; - import java.nio.file.Paths; import javax.xml.parsers.*; import javax.xml.transform.*; import javax.xml.transform.dom.*; import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR; import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR; import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; import javax.xml.transform.stream.*; import static jaxp.library.JAXPTestUtilities.compareWithGold; - import static jaxp.library.JAXPTestUtilities.failCleanup; - import static jaxp.library.JAXPTestUtilities.failUnexpected; import static org.testng.Assert.assertTrue; import org.testng.annotations.Test; import org.w3c.dom.*; import org.xml.sax.SAXException; /** * Class containing the test cases for TransformerFactory API's * getAssociatedStyleSheet method. */ ! public class TransformerFactoryTest { /** * This test case checks for the getAssociatedStylesheet method * of TransformerFactory. * The style sheet returned is then copied to an tfactory01.out ! * It will then be verified to see if it matches the golden files */ @Test ! public void tfactory01() { String outputFile = CLASS_DIR + "tfactory01.out"; String goldFile = GOLDEN_DIR + "tfactory01GF.out"; String xmlFile = XML_DIR + "TransformerFactoryTest.xml"; String xmlURI = "file:///" + XML_DIR; --- 23,69 ---- package javax.xml.transform.ptests; import java.io.*; import java.io.FileOutputStream; import java.io.IOException; import javax.xml.parsers.*; import javax.xml.transform.*; import javax.xml.transform.dom.*; import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR; import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR; import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR; import javax.xml.transform.stream.*; + import jaxp.library.JAXPFileBaseTest; import static jaxp.library.JAXPTestUtilities.compareWithGold; import static org.testng.Assert.assertTrue; import org.testng.annotations.Test; import org.w3c.dom.*; import org.xml.sax.SAXException; /** * Class containing the test cases for TransformerFactory API's * getAssociatedStyleSheet method. */ ! public class TransformerFactoryTest extends JAXPFileBaseTest { /** * This test case checks for the getAssociatedStylesheet method * of TransformerFactory. * The style sheet returned is then copied to an tfactory01.out ! * It will then be verified to see if it matches the golden files. ! * ! * @throws SAXException If any parse errors occur. ! * @throws IOException if the file exists but is a directory rather than ! * a regular file, does not exist but cannot be created, or cannot ! * be opened for any other reason. ! * @throws TransformerException If an unrecoverable error occurs during the ! * course of the transformation. ! * @throws ParserConfigurationException if a DocumentBuilder cannot be ! * created which satisfies the configuration requested. */ @Test ! public void tfactory01() throws ParserConfigurationException, SAXException, ! IOException, TransformerException { String outputFile = CLASS_DIR + "tfactory01.out"; String goldFile = GOLDEN_DIR + "tfactory01GF.out"; String xmlFile = XML_DIR + "TransformerFactoryTest.xml"; String xmlURI = "file:///" + XML_DIR;
*** 74,85 **** Source s = tFactory.getAssociatedStylesheet(domSource, "screen", "Modern", null); Transformer t = tFactory.newTransformer(); t.transform(s, streamResult); - assertTrue(compareWithGold(goldFile, outputFile)); - } catch (IOException | ParserConfigurationException - | TransformerException | SAXException ex) { - failUnexpected(ex); } } } --- 80,88 ---- Source s = tFactory.getAssociatedStylesheet(domSource, "screen", "Modern", null); Transformer t = tFactory.newTransformer(); t.transform(s, streamResult); } + assertTrue(compareWithGold(goldFile, outputFile)); } }
< prev index next >