本文整理匯總了Java中javax.xml.validation.Validator.getProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java Validator.getProperty方法的具體用法?Java Validator.getProperty怎麽用?Java Validator.getProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.xml.validation.Validator
的用法示例。
在下文中一共展示了Validator.getProperty方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testPropertyReset
import javax.xml.validation.Validator; //導入方法依賴的package包/類
@Test
public void testPropertyReset() throws Exception {
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = makeSchema(factory, null);
Validator validator = schema.newValidator();
Object beforeReset = validator.getProperty(SECURITY_MANAGER);
validator.setProperty(SECURITY_MANAGER, null);
Object changed = validator.getProperty(SECURITY_MANAGER);
//for JDK, this is changed since by default the security manager is set
assertTrue("Property value should have changed after calling setProperty().", beforeReset != changed);
validator.reset();
Object afterReset = validator.getProperty(SECURITY_MANAGER);
assertTrue("Property value should be the same after calling reset()", beforeReset == afterReset);
}
示例2: test01
import javax.xml.validation.Validator; //導入方法依賴的package包/類
@Test
public void test01() throws SAXException {
Validator validator = schemaFactory.newSchema().newValidator();
try {
validator.getProperty(null);
Assert.fail("exception expected");
} catch (NullPointerException e) {
;
}
}
示例3: testGetNullProperty
import javax.xml.validation.Validator; //導入方法依賴的package包/類
@Test(expectedExceptions = NullPointerException.class)
public void testGetNullProperty() throws SAXNotRecognizedException, SAXNotSupportedException {
Validator validator = getValidator();
assertNotNull(validator);
validator.getProperty(null);
}
示例4: testGetUnrecognizedProperty
import javax.xml.validation.Validator; //導入方法依賴的package包/類
@Test(expectedExceptions = SAXNotRecognizedException.class)
public void testGetUnrecognizedProperty() throws SAXNotRecognizedException, SAXNotSupportedException {
Validator validator = getValidator();
validator.getProperty(UNRECOGNIZED_NAME);
}