--- /dev/null 2018-10-30 06:40:14.375536168 -0700 +++ new/test/jaxp/javax/xml/jaxp/unittest/transform/OutputPropertiesTest.java 2019-03-11 12:10:52.850086369 -0700 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package transform; + +import java.io.StringReader; +import java.util.Properties; +import javax.xml.transform.Templates; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamSource; +import org.testng.Assert; +import org.testng.annotations.Test; + +/* + * @test + * @bug 8219705 + * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest + * @run testng transform.OutputPropertiesTest + * @summary Verifies the output properties are set correctly + */ +public class OutputPropertiesTest { + @Test + public void testOutputProperties() throws Exception { + String xslData = "" + + "\n" + + " \n" + + " \n" + + " Hello World! \n" + + " \n" + + ""; + + System.out.println(xslData); + + Templates templates = TransformerFactory.newInstance() + .newTemplates(new StreamSource(new StringReader(xslData))); + + Properties properties = templates.getOutputProperties(); + String[] prNames = new String[]{"method", "version", "indent", "media-type"}; + String[] prValues = new String[]{"html", "4.0", "yes", "text/xhtml"}; + + for (int i = 0; i < prNames.length; i++) { + String value = properties.getProperty(prNames[i]); + String msg = "The value of the property '" + prNames[i] + "' should be '" + + prValues[i] + "' when the method is '" + prValues[0] + "'. \n"; + Assert.assertEquals(value, prValues[i], msg); + System.out.println( + prNames[i] + ": actual: " + value + ", expected: " + prValues[i]); + } + } +}