author | joehw |
Wed, 28 Jan 2015 22:49:58 -0800 | |
changeset 28697 | fae50549d70d |
child 40223 | 64662417aa2d |
permissions | -rw-r--r-- |
28697
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
1 |
/* |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
2 |
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
4 |
* |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
8 |
* |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
13 |
* accompanied this code). |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
14 |
* |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
18 |
* |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
21 |
* questions. |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
22 |
*/ |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
23 |
package javax.xml.validation.ptests; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
24 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
25 |
import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
26 |
import static javax.xml.validation.ptests.ValidationTestConst.XML_DIR; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
27 |
import static org.testng.Assert.assertFalse; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
28 |
import static org.testng.Assert.assertNotNull; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
29 |
import static org.testng.Assert.assertNull; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
30 |
import static org.testng.Assert.assertSame; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
31 |
import static org.testng.Assert.assertTrue; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
32 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
33 |
import java.io.File; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
34 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
35 |
import javax.xml.validation.Schema; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
36 |
import javax.xml.validation.SchemaFactory; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
37 |
import javax.xml.validation.ValidatorHandler; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
38 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
39 |
import org.testng.annotations.BeforeClass; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
40 |
import org.testng.annotations.Test; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
41 |
import org.xml.sax.ContentHandler; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
42 |
import org.xml.sax.ErrorHandler; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
43 |
import org.xml.sax.SAXException; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
44 |
import org.xml.sax.SAXNotRecognizedException; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
45 |
import org.xml.sax.SAXNotSupportedException; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
46 |
import org.xml.sax.helpers.DefaultHandler; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
47 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
48 |
/* |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
49 |
* @summary Class containing the test cases for ValidatorHandler API |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
50 |
*/ |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
51 |
public class ValidatorHandlerTest { |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
52 |
@BeforeClass |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
53 |
public void setup() throws SAXException { |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
54 |
schema = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI).newSchema(new File(XML_DIR + "test.xsd")); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
55 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
56 |
assertNotNull(schema); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
57 |
} |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
58 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
59 |
@Test |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
60 |
public void testErrorHandler() { |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
61 |
ValidatorHandler validatorHandler = getValidatorHandler(); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
62 |
assertNull(validatorHandler.getErrorHandler(), "When ValidatorHandler is created, initially ErrorHandler should not be set."); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
63 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
64 |
ErrorHandler handler = new MyErrorHandler(); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
65 |
validatorHandler.setErrorHandler(handler); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
66 |
assertSame(validatorHandler.getErrorHandler(), handler); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
67 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
68 |
} |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
69 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
70 |
@Test(expectedExceptions = SAXNotRecognizedException.class) |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
71 |
public void testGetUnrecognizedProperty() throws SAXNotRecognizedException, SAXNotSupportedException { |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
72 |
ValidatorHandler validatorHandler = getValidatorHandler(); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
73 |
validatorHandler.getProperty(FEATURE_NAME); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
74 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
75 |
} |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
76 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
77 |
@Test(expectedExceptions = SAXNotRecognizedException.class) |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
78 |
public void testSetUnrecognizedProperty() throws SAXNotRecognizedException, SAXNotSupportedException { |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
79 |
ValidatorHandler validatorHandler = getValidatorHandler(); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
80 |
validatorHandler.setProperty(FEATURE_NAME, "test"); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
81 |
} |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
82 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
83 |
@Test(expectedExceptions = NullPointerException.class) |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
84 |
public void testGetNullProperty() throws SAXNotRecognizedException, SAXNotSupportedException { |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
85 |
ValidatorHandler validatorHandler = getValidatorHandler(); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
86 |
assertNotNull(validatorHandler); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
87 |
validatorHandler.getProperty(null); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
88 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
89 |
} |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
90 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
91 |
@Test(expectedExceptions = NullPointerException.class) |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
92 |
public void testSetNullProperty() throws SAXNotRecognizedException, SAXNotSupportedException { |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
93 |
ValidatorHandler validatorHandler = getValidatorHandler(); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
94 |
assertNotNull(validatorHandler); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
95 |
validatorHandler.setProperty(null, "test"); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
96 |
} |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
97 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
98 |
public void testFeature() throws SAXNotRecognizedException, SAXNotSupportedException { |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
99 |
ValidatorHandler validatorHandler = getValidatorHandler(); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
100 |
assertFalse(validatorHandler.getFeature(FEATURE_NAME), "The feature should be false by default."); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
101 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
102 |
validatorHandler.setFeature(FEATURE_NAME, true); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
103 |
assertTrue(validatorHandler.getFeature(FEATURE_NAME), "The feature should be false by default."); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
104 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
105 |
} |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
106 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
107 |
@Test(expectedExceptions = NullPointerException.class) |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
108 |
public void testGetNullFeature() throws SAXNotRecognizedException, SAXNotSupportedException { |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
109 |
ValidatorHandler validatorHandler = getValidatorHandler(); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
110 |
assertNotNull(validatorHandler); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
111 |
validatorHandler.getFeature(null); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
112 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
113 |
} |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
114 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
115 |
@Test(expectedExceptions = NullPointerException.class) |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
116 |
public void testSetNullFeature() throws SAXNotRecognizedException, SAXNotSupportedException { |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
117 |
ValidatorHandler validatorHandler = getValidatorHandler(); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
118 |
assertNotNull(validatorHandler); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
119 |
validatorHandler.setFeature(null, true); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
120 |
} |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
121 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
122 |
@Test |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
123 |
public void testContentHandler() { |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
124 |
ValidatorHandler validatorHandler = getValidatorHandler(); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
125 |
assertNull(validatorHandler.getContentHandler(), "When ValidatorHandler is created, initially ContentHandler should not be set."); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
126 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
127 |
ContentHandler handler = new DefaultHandler(); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
128 |
validatorHandler.setContentHandler(handler); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
129 |
assertSame(validatorHandler.getContentHandler(), handler); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
130 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
131 |
validatorHandler.setContentHandler(null); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
132 |
assertNull(validatorHandler.getContentHandler()); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
133 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
134 |
} |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
135 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
136 |
private ValidatorHandler getValidatorHandler() { |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
137 |
return schema.newValidatorHandler(); |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
138 |
} |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
139 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
140 |
private static final String FEATURE_NAME = "http://xml.org/sax/features/namespace-prefixes"; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
141 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
142 |
private Schema schema; |
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
143 |
|
fae50549d70d
8051547: Convert JAXP function tests: javax.xml.validation.* to jtreg (testng) tests
joehw
parents:
diff
changeset
|
144 |
} |