Index: src/testcases/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java =================================================================== RCS file: /home/cvspublic/ant/src/testcases/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java,v retrieving revision 1.12 diff -u -r1.12 XmlValidateTest.java --- src/testcases/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java 23 Sep 2003 14:33:43 -0000 1.12 +++ src/testcases/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java 24 Sep 2003 22:05:23 -0000 @@ -53,9 +53,6 @@ */ package org.apache.tools.ant.taskdefs.optional; -import java.io.*; -import java.util.Properties; - import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildFileTest; @@ -74,8 +71,8 @@ /** * where tasks run */ - private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/"; - + private final static String TASKDEFS_DIR = + "src/etc/testcases/taskdefs/optional/"; /** * Constructor @@ -86,7 +83,6 @@ super(name); } - /** * The JUnit setup method */ @@ -94,28 +90,23 @@ configureProject(TASKDEFS_DIR + "xmlvalidate.xml"); } - /** * The teardown method for JUnit */ - public void tearDown() { - - } - + public void tearDown() {} /** * Basic inline 'dtd' element test. */ public void testValidate() throws Exception { - executeTarget("testValidate"); + executeTarget("testValidate"); } - /** * Test indirect validation. */ public void testDeepValidate() throws Exception { - executeTarget("testDeepValidate"); + executeTarget("testDeepValidate"); } /** @@ -163,10 +154,11 @@ try { executeTarget("testSchemaGood"); } catch (BuildException e) { - if (e.getMessage() - .endsWith(" doesn't recognize feature http://apache.org/xml/features/validation/schema") || - e.getMessage() - .endsWith(" doesn't support feature http://apache.org/xml/features/validation/schema")) { + if (e + .getMessage() + .endsWith(" doesn't recognize feature http://apache.org/xml/features/validation/schema") + || e.getMessage().endsWith( + " doesn't support feature http://apache.org/xml/features/validation/schema")) { System.err.println(" skipped, parser doesn't support schema"); } else { throw e; @@ -181,18 +173,20 @@ executeTarget("testSchemaBad"); fail("Should throw BuildException because 'Bad Schema Validation'"); - expectBuildExceptionContaining("testSchemaBad", - "Bad Schema Validation", - "not a valid XML document"); + expectBuildExceptionContaining( + "testSchemaBad", + "Bad Schema Validation", + "not a valid XML document"); } catch (BuildException e) { - if (e.getMessage() - .endsWith(" doesn't recognize feature http://apache.org/xml/features/validation/schema") || - e.getMessage() - .endsWith(" doesn't support feature http://apache.org/xml/features/validation/schema")) { + if (e + .getMessage() + .endsWith(" doesn't recognize feature http://apache.org/xml/features/validation/schema") + || e.getMessage().endsWith( + " doesn't support feature http://apache.org/xml/features/validation/schema")) { System.err.println(" skipped, parser doesn't support schema"); } else { - assertTrue(e.getMessage() - .indexOf("not a valid XML document") > -1); + assertTrue( + e.getMessage().indexOf("not a valid XML document") > -1); } } } @@ -216,6 +210,18 @@ */ public void testUtf8() { expectBuildException("testUtf8", "invalid characters in file"); + } + + // Tests property element, using XML schema properties as an example. + + public void testPropertySchemaForValidXML() { + executeTarget("testProperty.validXML"); + } + + public void testPropertySchemaForInvalidXML() { + expectBuildException( + "testProperty.invalidXML", + "XML file does not satisfy schema."); } }