diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-01-09 17:50:54 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-01-09 17:50:54 -0800 |
commit | a0881d052ee72e3f7e773374e9b1aa75fbd6be4c (patch) | |
tree | 8a9462436077d0d906368cb21f521f1bf8a25500 /xml | |
parent | dd828f42a5c83b4270d4fbf6fce2da1878f1e84a (diff) | |
download | libcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.zip libcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.tar.gz libcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.tar.bz2 |
auto import from //branches/cupcake/...@125939
Diffstat (limited to 'xml')
110 files changed, 9644 insertions, 3282 deletions
diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/AllTests.java b/xml/src/test/java/tests/api/javax/xml/parsers/AllTests.java index 4fe3e4e..f0e8ebd 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/AllTests.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/AllTests.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -31,18 +31,15 @@ public class AllTests { } public static Test suite() { - TestSuite suite = new TestSuite("All tests for package tests.api.javax.xml.parsers;"); + TestSuite suite = tests.TestSuiteFactory.createTestSuite("All tests for package tests.api.javax.xml.parsers;"); // $JUnit-BEGIN$ -// Has one failing test due to coalescing not being supported. suite.addTestSuite(DocumentBuilderFactoryTest.class); -// Has one failing test due to limitation (input must be file or stream). suite.addTestSuite(DocumentBuilderTest.class); suite.addTestSuite(FactoryConfigurationErrorTest.class); suite.addTestSuite(ParserConfigurationExceptionTest.class); - suite.addTestSuite(SAXParserFactoryTest.class); -// Has a couple of failures due to limitations of the XmlPull SAX wrapper. -// suite.addTestSuite(SAXParserTest.class); + suite.addTestSuite(SAXParserFactoryTest.class); + suite.addTestSuite(SAXParserTest.class); suite.addTestSuite(ExpatParserTest.class); // $JUnit-END$ diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderFactoryTest.java b/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderFactoryTest.java index e1f377a..1e1ffdd 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderFactoryTest.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderFactoryTest.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package tests.api.javax.xml.parsers; -import dalvik.annotation.TestInfo; +import dalvik.annotation.KnownFailure; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import junit.framework.TestCase; @@ -30,6 +30,8 @@ import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; +import tests.api.javax.xml.parsers.SAXParserFactoryTest.MyHandler; + import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; @@ -40,6 +42,7 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; @TestTargetClass(DocumentBuilderFactory.class) public class DocumentBuilderFactoryTest extends TestCase { @@ -72,15 +75,12 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#DocumentBuilderFactory(). */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "DocumentBuilderFactory", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "DocumentBuilderFactory", + args = {} + ) public void test_Constructor() { try { new DocumentBuilderFactoryChild(); @@ -199,15 +199,12 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#isCoalescing(). */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "isCoalescing", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isCoalescing", + args = {} + ) public void test_isCoalescing() { dbf.setCoalescing(true); assertTrue(dbf.isCoalescing()); @@ -219,15 +216,12 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#isExpandEntityReferences(). */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "isExpandEntityReferences", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isExpandEntityReferences", + args = {} + ) public void test_isExpandEntityReferences() { dbf.setExpandEntityReferences(true); assertTrue(dbf.isExpandEntityReferences()); @@ -239,15 +233,12 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#isIgnoringComments(). */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "isIgnoringComments", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isIgnoringComments", + args = {} + ) public void test_isIgnoringComments() { dbf.setIgnoringComments(true); assertTrue(dbf.isIgnoringComments()); @@ -259,15 +250,12 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#isIgnoringElementContentWhitespace(). */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "isIgnoringElementContentWhitespace", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isIgnoringElementContentWhitespace", + args = {} + ) public void test_isIgnoringElementContentWhitespace() { dbf.setIgnoringElementContentWhitespace(true); assertTrue(dbf.isIgnoringElementContentWhitespace()); @@ -279,15 +267,12 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#isNamespaceAware(). */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "isNamespaceAware", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isNamespaceAware", + args = {} + ) public void test_isNamespaceAware() { dbf.setNamespaceAware(true); assertTrue(dbf.isNamespaceAware()); @@ -296,19 +281,21 @@ public class DocumentBuilderFactoryTest extends TestCase { assertFalse(dbf.isNamespaceAware()); } - /** - * @tests javax.xml.parsers.DocumentBuilderFactory#isValidating(). - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "isValidating", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isValidating", + args = {} + ), + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "", + method = "setValidating", + args = {boolean.class} ) }) - public void test_isValidating() { + public void test_setIsValidating() { dbf.setValidating(true); assertTrue(dbf.isValidating()); @@ -316,29 +303,38 @@ public class DocumentBuilderFactoryTest extends TestCase { assertFalse(dbf.isValidating()); } - /** - * @tests javax.xml.parsers.DocumentBuilderFactory#isXIncludeAware(). - */ -// public void test_isXIncludeAware() { -// dbf.setXIncludeAware(true); -// assertTrue(dbf.isXIncludeAware()); -// -// dbf.setXIncludeAware(false); -// assertFalse(dbf.isXIncludeAware()); -// } + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isXIncludeAware", + args = {} + ), + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "", + method = "setXIncludeAware", + args = {boolean.class} + ) + }) + @KnownFailure("Should handle XIncludeAware flag more gracefully") + public void test_isSetXIncludeAware() { + dbf.setXIncludeAware(true); + assertTrue(dbf.isXIncludeAware()); + + dbf.setXIncludeAware(false); + assertFalse(dbf.isXIncludeAware()); + } /** * @tests javax.xml.parsers.DocumentBuilderFactory#newInstance(). */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "newInstance", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "newInstance", + args = {} + ) public void test_newInstance() { String className = null; try { @@ -389,6 +385,31 @@ public class DocumentBuilderFactoryTest extends TestCase { } } + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "SAXException untested; unused on Android", + method = "newDocumentBuilder", + args = {} + ) + public void test_newDocumentBuilder() { + // Ordinary case + try { + DocumentBuilder db = dbf.newDocumentBuilder(); + assertTrue(db instanceof DocumentBuilder); + db.parse(getClass().getResourceAsStream("/simple.xml")); + } catch(Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + // Exception case + dbf.setValidating(true); + try { + DocumentBuilder db = dbf.newDocumentBuilder(); + } catch(ParserConfigurationException e) { + // Expected, since Android doesn't have a validating parser. + } + } + /** * @tests javax.xml.parsers.DocumentBuilderFactory#setAttribute(java.lang.String, * java.lang.Object). @@ -433,16 +454,14 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#setCoalescing(boolean). */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "setCoalescing", - methodArgs = {boolean.class} - ) - }) - public void _test_setCoalescingZ() { + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setCoalescing", + args = {boolean.class} + ) + @KnownFailure("Should support coalescing") + public void test_setCoalescingZ() { dbf.setCoalescing(true); assertTrue(dbf.isCoalescing()); @@ -507,15 +526,12 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#setExpandEntityReferences(boolean). */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "setExpandEntityReferences", - methodArgs = {boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setExpandEntityReferences", + args = {boolean.class} + ) public void test_setExpandEntityReferencesZ() { dbf.setExpandEntityReferences(true); assertTrue(dbf.isExpandEntityReferences()); @@ -571,16 +587,21 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#setFeature(java.lang.String). */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "setFeature", - methodArgs = {java.lang.String.class, boolean.class} + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getFeature", + args = {java.lang.String.class} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setFeature", + args = {java.lang.String.class, boolean.class} ) }) - public void test_setFeatureLjava_lang_String() { + public void test_getSetFeatureLjava_lang_String() { String[] features = { "http://xml.org/sax/features/namespaces", "http://xml.org/sax/features/validation" }; try { @@ -626,15 +647,12 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#setIgnoringComments(boolean). */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "setIgnoringComments", - methodArgs = {boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setIgnoringComments", + args = {boolean.class} + ) public void test_setIgnoringCommentsZ() { commentElements.clear(); @@ -686,15 +704,12 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#setIgnoringElementContentWhitespace(boolean). */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "setIgnoringElementContentWhitespace", - methodArgs = {boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setIgnoringElementContentWhitespace", + args = {boolean.class} + ) public void test_setIgnoringElementContentWhitespaceZ() { dbf.setIgnoringElementContentWhitespace(true); assertTrue(dbf.isIgnoringElementContentWhitespace()); @@ -738,15 +753,12 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#setNamespaceAware(boolean). */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "setNamespaceAware", - methodArgs = {boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setNamespaceAware", + args = {boolean.class} + ) public void test_setNamespaceAwareZ() { dbf.setNamespaceAware(true); assertTrue(dbf.isNamespaceAware()); @@ -787,6 +799,38 @@ public class DocumentBuilderFactoryTest extends TestCase { } } + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getAttribute", + args = {java.lang.String.class} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setAttribute", + args = {java.lang.String.class, Object.class} + ) + }) + public void test_getSetAttribute() { + // Android SAX implementation doesn't support attributes, so + // we can only make sure the expected exception is thrown. + try { + dbf.setAttribute("foo", new Object()); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + // Expected + } + + try { + dbf.getAttribute("foo"); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + // Expected + } + } + /** * @tests javax.xml.parsers.DocumentBuilderFactory#setSchema(javax.xml.validation.Schema). */ diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderTest.java b/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderTest.java index 70fc334..181e8f5 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderTest.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderTest.java @@ -16,28 +16,36 @@ package tests.api.javax.xml.parsers; -import dalvik.annotation.TestInfo; -import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; -import dalvik.annotation.TestTargetClass; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; import junit.framework.TestCase; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.EntityReference; +import org.w3c.dom.Text; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; +import tests.api.org.xml.sax.support.MethodLogger; +import tests.api.org.xml.sax.support.MockHandler; +import tests.api.org.xml.sax.support.MockResolver; +import dalvik.annotation.BrokenTest; +import dalvik.annotation.KnownFailure; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; @TestTargetClass(DocumentBuilder.class) public class DocumentBuilderTest extends TestCase { @@ -133,19 +141,13 @@ public class DocumentBuilderTest extends TestCase { super.tearDown(); } - /** - * @tests javax.xml.parsers.DocumentBuilder#DocumentBuilder() - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "DocumentBuilder", - methodArgs = {} - ) - }) - public void test_Constructor() { + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "DocumentBuilder", + args = {} + ) + public void testDocumentBuilder() { try { new MockDocumentBuilder(); } catch (Exception e) { @@ -172,20 +174,92 @@ public class DocumentBuilderTest extends TestCase { } } */ - /** - * @tests javax.xml.parsers.DocumentBuilder#isXIncludeAware() - */ -// public void test_isXIncludeAware() { -// try { -// dbf.setXIncludeAware(true); -// assertTrue(dbf.newDocumentBuilder().isXIncludeAware()); -// -// dbf.setXIncludeAware(false); -// assertFalse(dbf.newDocumentBuilder().isXIncludeAware()); -// } catch (ParserConfigurationException pce) { -// fail("Unexpected ParserConfigurationException " + pce.toString()); -// } -// } + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "newDocument", + args = { } + ) + public void testNewDocument() { + Document d; + + try { + d = dbf.newDocumentBuilder().newDocument(); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertNotNull(d); + assertNull(d.getDoctype()); + assertNull(d.getDocumentElement()); + assertNull(d.getNamespaceURI()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getDOMImplementation", + args = { } + ) + public void testGetImplementation() { + DOMImplementation d; + + try { + d = dbf.newDocumentBuilder().getDOMImplementation(); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertNotNull(d); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isNamespaceAware", + args = {} + ) + public void testIsNamespaceAware() { + try { + dbf.setNamespaceAware(true); + assertTrue(dbf.newDocumentBuilder().isNamespaceAware()); + dbf.setNamespaceAware(false); + assertFalse(dbf.newDocumentBuilder().isNamespaceAware()); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "No validating parser in Android, hence not tested", + method = "isValidating", + args = {} + ) + public void testIsValidating() { + try { + dbf.setValidating(false); + assertFalse(dbf.newDocumentBuilder().isValidating()); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "No XInclude-aware parser in Android, hence not tested", + method = "isXIncludeAware", + args = {} + ) + @KnownFailure("Should handle XIncludeAware flag more gracefully") + public void testIsXIncludeAware() { + try { + dbf.setXIncludeAware(false); + assertFalse(dbf.newDocumentBuilder().isXIncludeAware()); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + } /** * @tests javax.xml.parsers.DocumentBuilder#parse(java.io.File) @@ -194,16 +268,14 @@ public class DocumentBuilderTest extends TestCase { * Case 3: Try to parse a non-existent file. * Case 4: Try to parse incorrect xml file. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.File.class} - ) - }) - public void _test_parseLjava_io_File() { + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "parse", + args = {java.io.File.class} + ) + @BrokenTest("Need to use XML file from correct location") + public void test_parseLjava_io_File() { File f = new File("/tmp/xml_source/simple.xml"); // case 1: Trivial use. try { @@ -263,15 +335,12 @@ public class DocumentBuilderTest extends TestCase { * Case 3: Try to parse a non-existent file. * Case 4: Try to parse incorrect xml file. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.InputStream.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "parse", + args = {java.io.InputStream.class} + ) public void test_parseLjava_io_InputStream() { InputStream is = getClass().getResourceAsStream("/simple.xml"); // case 1: Trivial use. @@ -326,6 +395,74 @@ public class DocumentBuilderTest extends TestCase { } /** + * @tests javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream) + * Case 1: Try to parse correct xml document. + * Case 2: Try to call parse() with null argument. + * Case 3: Try to parse a non-existent file. + * Case 4: Try to parse incorrect xml file. + */ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "parse", + args = { InputSource.class } + ) + public void testParseInputSource() { + InputStream stream = getClass().getResourceAsStream("/simple.xml"); + InputSource is = new InputSource(stream); + + // case 1: Trivial use. + try { + Document d = db.parse(is); + assertNotNull(d); + // TBD getXmlEncoding() IS NOT SUPPORTED + // assertEquals("ISO-8859-1", d.getXmlEncoding()); + assertEquals(2, d.getChildNodes().getLength()); + assertEquals("#comment", + d.getChildNodes().item(0).getNodeName()); + assertEquals("breakfast_menu", + d.getChildNodes().item(1).getNodeName()); + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch (SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); + } + + // case 2: Try to call parse with null argument + try { + db.parse((InputSource)null); + fail("Expected IllegalArgumentException was not thrown"); + } catch (IllegalArgumentException iae) { + // expected + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch (SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); + } + + // case 3: Try to parse a non-existent file + try { + db.parse(new InputSource(new FileInputStream("_"))); + fail("Expected IOException was not thrown"); + } catch (IOException ioe) { + // expected + } catch (SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); + } + + // case 4: Try to parse incorrect xml file + try { + is = new InputSource(getClass().getResourceAsStream("/wrong.xml")); + db.parse(is); + fail("Expected SAXException was not thrown"); + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch (SAXException sax) { + // expected + } + } + + /** * @tests javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream, * java.lang.String) * Case 1: Try to parse correct xml document. @@ -333,15 +470,12 @@ public class DocumentBuilderTest extends TestCase { * Case 3: Try to parse a non-existent file. * Case 4: Try to parse incorrect xml file. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.InputStream.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "parse", + args = {java.io.InputStream.class, java.lang.String.class} + ) public void test_parseLjava_io_InputStreamLjava_lang_String() { InputStream is = getClass().getResourceAsStream("/systemid.xml"); // case 1: Trivial use. @@ -407,16 +541,14 @@ public class DocumentBuilderTest extends TestCase { * Case 3: Try to parse a non-existent uri. * Case 4: Try to parse incorrect xml file. */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.lang.String.class} - ) - }) - public void _test_parseLjava_lang_String() { + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "parse", + args = {java.lang.String.class} + ) + @KnownFailure("Android DocumentBuilder should support File sources") + public void test_parseLjava_lang_String() { // case 1: Trivial use. File f = new File(getClass().getResource("/simple.xml").getFile()); try { @@ -469,27 +601,133 @@ public class DocumentBuilderTest extends TestCase { } } - /** - * @tests javax.xml.parsers.DocumentBuilder#reset() - */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify that reset() method resets the DocumentBuilder " + - "to its original configuration.", - targets = { - @TestTarget( - methodName = "reset", - methodArgs = {} - ) - }) - public void test_reset() { - try { - dbf = DocumentBuilderFactory.newInstance(); + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "reset", + args = { } + ) + @KnownFailure("Android DocumentBuilder should implement reset() properly") + public void testReset() { + // Make sure EntityResolver gets reset + InputStream source = new ByteArrayInputStream("<a>&foo;</a>".getBytes()); + InputStream entity = new ByteArrayInputStream("bar".getBytes()); + + MockResolver resolver = new MockResolver(); + resolver.addEntity("foo", "foo", new InputSource(entity)); + + Document d; + + try { db = dbf.newDocumentBuilder(); + db.setEntityResolver(resolver); db.reset(); - } catch (ParserConfigurationException pce) { - fail("Unexpected ParserConfigurationException " + pce.toString()); + d = db.parse(source); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); } + + Element root = (Element)d.getElementsByTagName("a").item(0); + assertEquals("foo", ((EntityReference)root.getFirstChild()).getNodeName()); + + // Make sure ErrorHandler gets reset + source = new ByteArrayInputStream("</a>".getBytes()); + + MethodLogger logger = new MethodLogger(); + ErrorHandler handler = new MockHandler(logger); + + try { + db = dbf.newDocumentBuilder(); + db.setErrorHandler(handler); + db.reset(); + d = db.parse(source); + } catch (SAXParseException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(0, logger.size()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setErrorHandler", + args = { ErrorHandler.class } + ) + public void testSetErrorHandler() { + // Ordinary case + InputStream source = new ByteArrayInputStream("</a>".getBytes()); + + MethodLogger logger = new MethodLogger(); + ErrorHandler handler = new MockHandler(logger); + + try { + db = dbf.newDocumentBuilder(); + db.setErrorHandler(handler); + db.parse(source); + } catch (SAXParseException e) { + // Expected, ErrorHandler does not mask exception + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals("error", logger.getMethod()); + assertTrue(logger.getArgs()[0] instanceof SAXParseException); + + // null case + source = new ByteArrayInputStream("</a>".getBytes()); + + try { + db = dbf.newDocumentBuilder(); + db.setErrorHandler(null); + db.parse(source); + } catch (SAXParseException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setEntityResolver", + args = { EntityResolver.class } + ) + @KnownFailure("Android DocumentBuilder should support entity resolving") + public void testSetEntityResolver() { + // Ordinary case + InputStream source = new ByteArrayInputStream("<a>&foo;</a>".getBytes()); + InputStream entity = new ByteArrayInputStream("bar".getBytes()); + + MockResolver resolver = new MockResolver(); + resolver.addEntity("foo", "foo", new InputSource(entity)); + + Document d; + + try { + db = dbf.newDocumentBuilder(); + db.setEntityResolver(resolver); + d = db.parse(source); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + Element root = (Element)d.getElementsByTagName("a").item(0); + assertEquals("bar", ((Text)root.getFirstChild()).getData()); + + // null case + source = new ByteArrayInputStream("<a>&foo;</a>".getBytes()); + + try { + db = dbf.newDocumentBuilder(); + db.setEntityResolver(null); + d = db.parse(source); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + root = (Element)d.getElementsByTagName("a").item(0); + assertEquals("foo", ((EntityReference)root.getFirstChild()).getNodeName()); } } diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/FactoryConfigurationErrorTest.java b/xml/src/test/java/tests/api/javax/xml/parsers/FactoryConfigurationErrorTest.java index 4e72c55..0b5f230 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/FactoryConfigurationErrorTest.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/FactoryConfigurationErrorTest.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,33 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package tests.api.javax.xml.parsers; -import dalvik.annotation.TestInfo; -import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; -import dalvik.annotation.TestTargetClass; +import javax.xml.parsers.FactoryConfigurationError; import junit.framework.TestCase; - -import javax.xml.parsers.FactoryConfigurationError; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; @TestTargetClass(FactoryConfigurationError.class) public class FactoryConfigurationErrorTest extends TestCase { - /** - * @tests javax.xml.parsers.FactoryConfigurationError#FactoryConfigurationError() - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "FactoryConfigurationError", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "FactoryConfigurationError", + args = {} + ) public void test_Constructor() { FactoryConfigurationError fce = new FactoryConfigurationError(); assertNull(fce.getMessage()); @@ -47,23 +38,12 @@ public class FactoryConfigurationErrorTest extends TestCase { assertNull(fce.getCause()); } - /** - * @tests javax.xml.parsers.FactoryConfigurationError - * #FactoryConfigurationError(java.lang.Exception) - * Case 1: Try to create FactoryConfigurationError - * which is based on Exception without parameters. - * Case 2: Try to create FactoryConfigurationError - * which is based on Exception with String parameter. - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "FactoryConfigurationError", - methodArgs = {java.lang.Exception.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "FactoryConfigurationError", + args = {java.lang.Exception.class} + ) public void test_ConstructorLjava_lang_Exception() { Exception e = new Exception(); // case 1: Try to create FactoryConfigurationError @@ -82,23 +62,12 @@ public class FactoryConfigurationErrorTest extends TestCase { assertEquals(e.getCause(), fce.getCause()); } - /** - * @tests javax.xml.parsers.FactoryConfigurationError - * #FactoryConfigurationError(java.lang.Exception, java.lang.String) - * Case 1: Try to create FactoryConfigurationError - * which is based on Exception without parameters. - * Case 2: Try to create FactoryConfigurationError - * which is based on Exception with String parameter. - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "FactoryConfigurationError", - methodArgs = {java.lang.Exception.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "FactoryConfigurationError", + args = {java.lang.Exception.class, java.lang.String.class} + ) public void test_ConstructorLjava_lang_ExceptionLjava_lang_String() { Exception e = new Exception(); // case 1: Try to create FactoryConfigurationError @@ -117,38 +86,25 @@ public class FactoryConfigurationErrorTest extends TestCase { assertEquals(e.getCause(), fce.getCause()); } - /** - * @tests javax.xml.parsers.FactoryConfigurationError - * #FactoryConfigurationError(java.lang.String) - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "FactoryConfigurationError", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "FactoryConfigurationError", + args = {java.lang.String.class} + ) public void test_ConstructorLjava_lang_String() { - FactoryConfigurationError fce = new FactoryConfigurationError("fixture"); - assertEquals("fixture", fce.getMessage()); - assertEquals("fixture", fce.getLocalizedMessage()); + FactoryConfigurationError fce = new FactoryConfigurationError("Oops!"); + assertEquals("Oops!", fce.getMessage()); + assertEquals("Oops!", fce.getLocalizedMessage()); assertNull(fce.getCause()); } - /** - * @tests avax.xml.parsers.FactoryConfigurationError#getException(). - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getException", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getException", + args = {} + ) public void test_getException() { FactoryConfigurationError fce = new FactoryConfigurationError(); assertNull(fce.getException()); @@ -162,18 +118,12 @@ public class FactoryConfigurationErrorTest extends TestCase { assertEquals(npe, fce.getException()); } - /** - * @tests avax.xml.parsers.FactoryConfigurationError#getMessage(). - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getMessage", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getMessage", + args = {} + ) public void test_getMessage() { assertNull(new FactoryConfigurationError().getMessage()); assertEquals("msg1", @@ -185,4 +135,5 @@ public class FactoryConfigurationErrorTest extends TestCase { new FactoryConfigurationError( new NullPointerException()).getMessage()); } + } diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/ParserConfigurationExceptionTest.java b/xml/src/test/java/tests/api/javax/xml/parsers/ParserConfigurationExceptionTest.java index 324f044..63b87a7 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/ParserConfigurationExceptionTest.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/ParserConfigurationExceptionTest.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,33 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package tests.api.javax.xml.parsers; -import dalvik.annotation.TestInfo; -import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; -import dalvik.annotation.TestTargetClass; +import javax.xml.parsers.ParserConfigurationException; import junit.framework.TestCase; - -import javax.xml.parsers.ParserConfigurationException; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; @TestTargetClass(ParserConfigurationException.class) public class ParserConfigurationExceptionTest extends TestCase{ - /** - * @tests javax.xml.parsers.ParserConfigurationException#ParserConfigurationException() - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "ParserConfigurationException", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "ParserConfigurationException", + args = {} + ) public void test_Constructor() { ParserConfigurationException pce = new ParserConfigurationException(); assertNull(pce.getMessage()); @@ -47,24 +38,18 @@ public class ParserConfigurationExceptionTest extends TestCase{ assertNull(pce.getCause()); } - /** - * @tests javax.xml.parsers.ParserConfigurationException - * #ParserConfigurationException(java.lang.String) - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "ParserConfigurationException", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "ParserConfigurationException", + args = {java.lang.String.class} + ) public void test_ConstructorLjava_lang_String() { ParserConfigurationException pce = - new ParserConfigurationException("fixture"); - assertEquals("fixture", pce.getMessage()); - assertEquals("fixture", pce.getLocalizedMessage()); + new ParserConfigurationException("Oops!"); + assertEquals("Oops!", pce.getMessage()); + assertEquals("Oops!", pce.getLocalizedMessage()); assertNull(pce.getCause()); } + } diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserFactoryTest.java b/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserFactoryTest.java index c053d09..5d41356 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserFactoryTest.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserFactoryTest.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,21 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package tests.api.javax.xml.parsers; -import dalvik.annotation.TestInfo; -import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; -import dalvik.annotation.TestTargetClass; - -import junit.framework.TestCase; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; -import org.xml.sax.helpers.DefaultHandler; - import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -40,6 +27,21 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; +import junit.framework.TestCase; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.helpers.DefaultHandler; + +import dalvik.annotation.AndroidOnly; +import dalvik.annotation.KnownFailure; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; +import dalvik.annotation.TestTargets; + @TestTargetClass(SAXParserFactory.class) public class SAXParserFactoryTest extends TestCase { @@ -67,85 +69,20 @@ public class SAXParserFactoryTest extends TestCase { is1.close(); } - /** - * @test javax.xml.parsers.SAXParserFactory#SAXParserFactory() - * - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "SAXParserFactory", - methodArgs = {} - ) - }) - public void _test_Constructor() { + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "SAXParserFactory", + args = {} + ) + @AndroidOnly("Android SAX implementation is non-validating") + public void test_Constructor() { MySAXParserFactory mpf = new MySAXParserFactory(); assertTrue(mpf instanceof SAXParserFactory); assertFalse(mpf.isValidating()); } /** - * @test javax.xml.parsers.SAXParserFactory#getFeature(java.lang.String) - * - */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify ParserConfigurationException, SAXNotSupportedException.", - targets = { - @TestTarget( - methodName = "getFeature", - methodArgs = {java.lang.String.class} - ) - }) - public void test_getFeatureLjava_lang_String() { - String[] features = { - "http://xml.org/sax/features/namespaces", - "http://xml.org/sax/features/validation"}; - for (int i = 0; i < features.length; i++) { - try { - spf.setFeature(features[i], true); - assertTrue(spf.getFeature(features[i])); - spf.setFeature(features[i], false); - assertFalse(spf.getFeature(features[i])); - } catch (ParserConfigurationException pce) { - fail("ParserConfigurationException is thrown"); - } catch (SAXNotRecognizedException snre) { - fail("SAXNotRecognizedException is thrown"); - } catch (SAXNotSupportedException snse) { - fail("SAXNotSupportedException is thrown"); - } - } - - try { - spf.getFeature(""); - fail("SAXNotRecognizedException is not thrown"); - } catch (ParserConfigurationException pce) { - fail("ParserConfigurationException is thrown"); - } catch (SAXNotRecognizedException snre) { - //expected - } catch (SAXNotSupportedException snse) { - fail("SAXNotSupportedException is thrown"); - } catch (NullPointerException npe) { - fail("NullPointerException is thrown"); - } - - try { - spf.getFeature(null); - fail("NullPointerException is not thrown"); - } catch (ParserConfigurationException pce) { - fail("ParserConfigurationException is thrown"); - } catch (SAXNotRecognizedException snre) { - fail("SAXNotRecognizedException is thrown"); - } catch (SAXNotSupportedException snse) { - fail("SAXNotSupportedException is thrown"); - } catch (NullPointerException npe) { - // expected - } - } - - /** * @tests javax.xml.parsers.SAXParserFactory#getSchema(). * TBD getSchema() IS NOT SUPPORTED */ @@ -162,20 +99,22 @@ public class SAXParserFactoryTest extends TestCase { } } */ - /** - * @test javax.xml.parsers.SAXParserFactory#isNamespaceAware() - * - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "setNamespaceAware", - methodArgs = {boolean.class} + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isNamespaceAware", + args = {} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "setNamespaceAware", + args = {boolean.class} ) }) - public void test_isNamespaceAware() { + public void test_setIsNamespaceAware() { spf.setNamespaceAware(true); assertTrue(spf.isNamespaceAware()); spf.setNamespaceAware(false); @@ -184,20 +123,21 @@ public class SAXParserFactoryTest extends TestCase { assertTrue(spf.isNamespaceAware()); } - /** - * @test javax.xml.parsers.SAXParserFactory#isValidating() - * - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "isValidating", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isValidating", + args = {} + ), + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "", + method = "setValidating", + args = {boolean.class} ) }) - public void test_isValidating() { + public void test_setIsValidating() { spf.setValidating(true); assertTrue(spf.isValidating()); spf.setValidating(false); @@ -206,31 +146,34 @@ public class SAXParserFactoryTest extends TestCase { assertTrue(spf.isValidating()); } - /** - * @test javax.xml.parsers.SAXParserFactory#isXIncludeAware() - * - */ -// public void test_isXIncludeAware() { -// assertFalse(spf.isXIncludeAware()); -// spf.setXIncludeAware(true); -// assertTrue(spf.isXIncludeAware()); -// spf.setXIncludeAware(false); -// assertFalse(spf.isXIncludeAware()); -// } - - /** - * @test javax.xml.parsers.SAXParserFactory#newInstance() - * - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "newInstance", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isXIncludeAware", + args = {} + ), + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "", + method = "setXIncludeAware", + args = {boolean.class} ) }) + @KnownFailure("Should handle XIncludeAware flag more gracefully") + public void test_setIsXIncludeAware() { + spf.setXIncludeAware(true); + assertTrue(spf.isXIncludeAware()); + spf.setXIncludeAware(false); + assertFalse(spf.isXIncludeAware()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "newInstance", + args = {} + ) public void test_newInstance() { String className = null; try { @@ -272,44 +215,52 @@ public class SAXParserFactoryTest extends TestCase { } } - /** - * @test javax.xml.parsers.SAXParserFactory#newSAXParser() - * - */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify exceptions.", - targets = { - @TestTarget( - methodName = "newSAXParser", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "SAXException untested; unused on Android", + method = "newSAXParser", + args = {} + ) public void test_newSAXParser() { + // Ordinary case try { SAXParser sp = spf.newSAXParser(); assertTrue(sp instanceof SAXParser); sp.parse(is1, new MyHandler()); } catch(Exception e) { - fail("Exception was thrown: " + e.toString()); + throw new RuntimeException("Unexpected exception", e); + } + + // Exception case + spf.setValidating(true); + try { + SAXParser sp = spf.newSAXParser(); + } catch(ParserConfigurationException e) { + // Expected, since Android doesn't have a validating parser. + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); } } - /** - * @test javax.xml.parsers.SAXParserFactory#setFeature(java.lang.String, - * boolean) - * - */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify SAXNotSupportedException, ParserConfigurationException.", - targets = { - @TestTarget( - methodName = "setFeature", - methodArgs = {java.lang.String.class, boolean.class} + @TestTargets({ + @TestTargetNew( + level = TestLevel.SUFFICIENT, + method = "setFeature", + notes = "ParserConfigurationException untested; unused on Android", + args = {java.lang.String.class, boolean.class} + ), + @TestTargetNew( + level = TestLevel.SUFFICIENT, + method = "getFeature", + notes = "ParserConfigurationException untested; unused on Android", + args = {java.lang.String.class} ) - }) + }) public void test_setFeatureLjava_lang_StringZ() { + // We can't verify ParserConfigurationException and + // SAXNotSupportedException since these are never + // thrown by Android. + String[] features = { "http://xml.org/sax/features/namespaces", "http://xml.org/sax/features/validation" }; @@ -341,19 +292,17 @@ public class SAXParserFactoryTest extends TestCase { fail("NullPointerException is thrown"); } -// Doesn't make sense for us. -// try { -// spf.setFeature("http://xml.org/sax/features/use-attributes2", true); -// fail("SAXNotSupportedException is not thrown"); -// } catch (ParserConfigurationException pce) { -// fail("ParserConfigurationException is thrown"); -// } catch (SAXNotRecognizedException snre) { -// fail("SAXNotRecognizedException is thrown"); -// } catch (SAXNotSupportedException snse) { -// //expected -// } catch (NullPointerException npe) { -// fail("NullPointerException is thrown"); -// } + try { + spf.setFeature("http://xml.org/sax/features/unknown-feature", true); + } catch (ParserConfigurationException pce) { + fail("ParserConfigurationException is thrown"); + } catch (SAXNotRecognizedException snre) { + fail("SAXNotRecognizedException is thrown"); + } catch (SAXNotSupportedException snse) { + // Acceptable, although this doesn't happen an Android. + } catch (NullPointerException npe) { + fail("NullPointerException is thrown"); + } try { spf.setFeature(null, true); @@ -369,20 +318,13 @@ public class SAXParserFactoryTest extends TestCase { } } - /** - * @test javax.xml.parsers.SAXParserFactory#setNamespaceAware(boolean) - * - */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify positive functionality.", - targets = { - @TestTarget( - methodName = "setNamespaceAware", - methodArgs = {boolean.class} - ) - }) - public void _test_setNamespaceAwareZ() { + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setNamespaceAware", + args = {boolean.class} + ) + @KnownFailure("Error in namespace feature handling (for ExpatParser)") + public void test_setNamespaceAwareZ() { spf.setNamespaceAware(true); MyHandler mh = new MyHandler(); @@ -392,7 +334,6 @@ public class SAXParserFactoryTest extends TestCase { } catch(javax.xml.parsers.ParserConfigurationException pce) { fail("ParserConfigurationException was thrown during parsing"); } catch(org.xml.sax.SAXException se) { - se.printStackTrace(); fail("SAXException was thrown during parsing"); } catch(IOException ioe) { fail("IOException was thrown during parsing"); @@ -409,6 +350,7 @@ public class SAXParserFactoryTest extends TestCase { } catch(javax.xml.parsers.ParserConfigurationException pce) { fail("ParserConfigurationException was thrown during parsing"); } catch(org.xml.sax.SAXException se) { + se.printStackTrace(); fail("SAXException was thrown during parsing"); } catch(IOException ioe) { fail("IOException was thrown during parsing"); @@ -434,10 +376,6 @@ public class SAXParserFactoryTest extends TestCase { } } - /** - * @tests javax.xml.parsers.SAXParserFactory#setSchema(javax.xml.validation.Schema) - * TBD getSchema() IS NOT SUPPORTED - */ /* public void test_setSchemaLjavax_xml_validation_Schema() { SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); @@ -450,10 +388,7 @@ public class SAXParserFactoryTest extends TestCase { } } */ - /** - * @tests javax.xml.parsers.SAXParserFactory#setValidating(boolean) - * - */ + // public void test_setValidatingZ() { // MyHandler mh = new MyHandler(); // InputStream is2 = getClass().getResourceAsStream("/recipe.xml"); @@ -520,10 +455,6 @@ public class SAXParserFactoryTest extends TestCase { // } // } - /** - * @test javax.xml.parsers.SAXParserFactory#setXIncludeAware(boolean) - * - */ // public void test_setXIncludeAwareZ() { // spf.setXIncludeAware(true); // MyHandler mh = new MyHandler(); @@ -599,20 +530,18 @@ public class SAXParserFactoryTest extends TestCase { return null; } - public void setFeature(String name, - boolean value) - throws ParserConfigurationException, - SAXNotRecognizedException, - SAXNotSupportedException { + public void setFeature(String name, boolean value) throws + ParserConfigurationException, SAXNotRecognizedException, + SAXNotSupportedException { } - public boolean getFeature(String name) - throws ParserConfigurationException, - SAXNotRecognizedException, - SAXNotSupportedException { + public boolean getFeature(String name) throws + ParserConfigurationException, SAXNotRecognizedException, + SAXNotSupportedException { return true; } } + } diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTest.java b/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTest.java index 83f7031..4ca0f1f 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTest.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTest.java @@ -13,44 +13,44 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package tests.api.javax.xml.parsers; -import dalvik.annotation.TestInfo; -import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; -import dalvik.annotation.TestTargetClass; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.util.HashMap; +import java.util.Vector; + +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; import junit.framework.TestCase; -import org.xml.sax.Attributes; import org.xml.sax.HandlerBase; import org.xml.sax.InputSource; -import org.xml.sax.Locator; import org.xml.sax.Parser; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; -import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; +import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.DefaultHandler; import tests.api.javax.xml.parsers.SAXParserTestSupport.MyDefaultHandler; import tests.api.javax.xml.parsers.SAXParserTestSupport.MyHandler; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.Vector; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; +import tests.api.org.xml.sax.support.BrokenInputStream; +import tests.api.org.xml.sax.support.MethodLogger; +import tests.api.org.xml.sax.support.MockHandler; +import dalvik.annotation.KnownFailure; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; +import dalvik.annotation.TestTargets; @SuppressWarnings("deprecation") @TestTargetClass(SAXParser.class) @@ -64,7 +64,6 @@ public class SAXParserTest extends TestCase { /* * @see javax.xml.parsers.SAXParser#getParser() */ - @SuppressWarnings("deprecation") @Override public Parser getParser() throws SAXException { // it is a fake @@ -119,6 +118,9 @@ public class SAXParserTest extends TestCase { } } + private static final String LEXICAL_HANDLER_PROPERTY + = "http://xml.org/sax/properties/lexical-handler"; + SAXParserFactory spf; SAXParser parser; @@ -256,19 +258,13 @@ public class SAXParserTest extends TestCase { // } // } - /** - * @tests javax.xml.parser.SAXParser#SAXParser(). - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "SAXParser", - methodArgs = {} - ) - }) - public void _test_Constructor() { + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "SAXParser", + args = {} + ) + public void testSAXParser() { try { new MockSAXParser(); } catch (Exception e) { @@ -296,74 +292,64 @@ public class SAXParserTest extends TestCase { } */ - /** - * @test javax.xml.parsers.SAXParser#isNamespaceAware() - * - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "isNamespaceAware", - methodArgs = {} - ) - }) - public void _test_isNamespaceAware() { - - spf.setNamespaceAware(true); - assertTrue(spf.isNamespaceAware()); - spf.setNamespaceAware(false); - assertFalse(spf.isNamespaceAware()); - spf.setNamespaceAware(true); - assertTrue(spf.isNamespaceAware()); + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "isNamespaceAware", + args = {} + ) + public void testIsNamespaceAware() { + try { + spf.setNamespaceAware(true); + assertTrue(spf.newSAXParser().isNamespaceAware()); + spf.setNamespaceAware(false); + assertFalse(spf.newSAXParser().isNamespaceAware()); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } } - /** - * @test javax.xml.parsers.SAXParser#isValidating() - * - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "isValidating", - methodArgs = {} - ) - }) - public void _test_isValidating() { - assertFalse(parser.isValidating()); - spf.setValidating(true); - assertFalse(parser.isValidating()); - spf.setValidating(false); - assertFalse(parser.isValidating()); + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "No validating parser in Android, hence not tested", + method = "isValidating", + args = {} + ) + public void testIsValidating() { + try { + spf.setValidating(false); + assertFalse(spf.newSAXParser().isValidating()); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } } - /** - * @test javax.xml.parser.SAXParser#isXIncludeAware() - * TODO X include aware is not supported - */ -// public void test_isXIncludeAware() { -// assertFalse(parser.isXIncludeAware()); -// spf.setXIncludeAware(true); -// assertFalse(parser.isXIncludeAware()); -// } + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "No XInclude-aware parser in Android, hence not tested", + method = "isXIncludeAware", + args = {} + ) + @KnownFailure("Should handle XIncludeAware flag more gracefully") + public void testIsXIncludeAware() { + try { + spf.setXIncludeAware(false); + assertFalse(spf.newSAXParser().isXIncludeAware()); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + } /** * @test javax.xml.parsers.SAXParser#parse(java.io.File, * org.xml.sax.helpers.DefaultHandler) */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify positive functionality properly; " + - "not all exceptions are verified.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.File.class, org.xml.sax.helpers.DefaultHandler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify positive functionality properly; not all exceptions are verified.", + method = "parse", + args = {java.io.File.class, org.xml.sax.helpers.DefaultHandler.class} + ) public void _test_parseLjava_io_FileLorg_xml_sax_helpers_DefaultHandler() throws Exception { @@ -400,28 +386,26 @@ public class SAXParserTest extends TestCase { } } - /** - * @test javax.xml.parsers.SAXParser#parse(java.io.File, - * org.xml.sax.HandlerBase) - */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify positive functionality properly; " + - "not all exceptions are verified.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.File.class, org.xml.sax.HandlerBase.class} - ) - }) - @SuppressWarnings("deprecation") - public void _test_parseLjava_io_FileLorg_xml_sax_HandlerBase() - throws Exception { + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "Sufficient while XML parser situation is still unclear", + method = "parse", + args = {java.io.File.class, org.xml.sax.HandlerBase.class} + ) + public void testParseFileHandlerBase() { for(int i = 0; i < list_wf.length; i++) { - HashMap<String, String> hm = sp.readFile(list_out_hb[i].getPath()); - MyHandler dh = new MyHandler(); - parser.parse(list_wf[i], dh); - assertTrue(SAXParserTestSupport.equalsMaps(hm, dh.createData())); + try { + HashMap<String, String> hm = sp.readFile( + list_out_hb[i].getPath()); + MyHandler dh = new MyHandler(); + parser.parse(list_wf[i], dh); + assertTrue(SAXParserTestSupport.equalsMaps(hm, + dh.createData())); + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch (SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); + } } for(int i = 0; i < list_nwf.length; i++) { @@ -431,6 +415,10 @@ public class SAXParserTest extends TestCase { fail("SAXException is not thrown"); } catch(org.xml.sax.SAXException se) { //expected + } catch (FileNotFoundException fne) { + fail("Unexpected FileNotFoundException " + fne.toString()); + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); } } @@ -440,12 +428,22 @@ public class SAXParserTest extends TestCase { fail("java.lang.IllegalArgumentException is not thrown"); } catch(java.lang.IllegalArgumentException iae) { //expected + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch(SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); } try { parser.parse(list_wf[0], (HandlerBase) null); } catch(java.lang.IllegalArgumentException iae) { fail("java.lang.IllegalArgumentException is thrown"); + } catch (FileNotFoundException fne) { + fail("Unexpected FileNotFoundException " + fne.toString()); + } catch(IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch(SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); } } @@ -453,15 +451,13 @@ public class SAXParserTest extends TestCase { * @test javax.xml.parsers.SAXParser#parse(org.xml.sax.InputSource, * org.xml.sax.helpers.DefaultHandler) */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify IOException.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {org.xml.sax.InputSource.class, org.xml.sax.helpers.DefaultHandler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify IOException.", + method = "parse", + args = {org.xml.sax.InputSource.class, org.xml.sax.helpers.DefaultHandler.class} + ) + public void _test_parseLorg_xml_sax_InputSourceLorg_xml_sax_helpers_DefaultHandler() throws Exception { @@ -501,41 +497,51 @@ public class SAXParserTest extends TestCase { } catch(java.lang.IllegalArgumentException iae) { fail("java.lang.IllegalArgumentException is thrown"); } + + try { + InputSource is = new InputSource(new BrokenInputStream(new FileInputStream(list_wf[0]), 10)); + parser.parse(is, (DefaultHandler) null); + fail("IOException expected"); + } catch(IOException e) { + // Expected + } } - /** - * @test javax.xml.parsers.SAXParser#parse(org.xml.sax.InputSource, - * org.xml.sax.HandlerBase) - */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify IOException.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {org.xml.sax.InputSource.class, org.xml.sax.HandlerBase.class} - ) - }) - @SuppressWarnings("deprecation") - public void _test_parseLorg_xml_sax_InputSourceLorg_xml_sax_HandlerBase() - throws Exception { + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "Sufficient while XML parser situation is still unclear", + method = "parse", + args = {org.xml.sax.InputSource.class, org.xml.sax.HandlerBase.class} + ) + public void testParseInputSourceHandlerBase() { for(int i = 0; i < list_wf.length; i++) { - HashMap<String, String> hm = sp.readFile(list_out_hb[i].getPath()); - MyHandler dh = new MyHandler(); - InputSource is = new InputSource(new FileInputStream(list_wf[i])); - parser.parse(is, dh); - assertTrue(SAXParserTestSupport.equalsMaps(hm, dh.createData())); + try { + HashMap<String, String> hm = sp.readFile( + list_out_hb[i].getPath()); + MyHandler dh = new MyHandler(); + InputSource is = new InputSource(new FileInputStream(list_wf[i])); + parser.parse(is, dh); + assertTrue(SAXParserTestSupport.equalsMaps(hm, + dh.createData())); + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch (SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); + } } for(int i = 0; i < list_nwf.length; i++) { try { MyHandler dh = new MyHandler(); - InputSource is = new InputSource(new FileInputStream( - list_nwf[i])); + InputSource is = new InputSource(new FileInputStream(list_nwf[i])); parser.parse(is, dh); fail("SAXException is not thrown"); } catch(org.xml.sax.SAXException se) { //expected + } catch (FileNotFoundException fne) { + fail("Unexpected FileNotFoundException " + fne.toString()); + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); } } @@ -545,6 +551,10 @@ public class SAXParserTest extends TestCase { fail("java.lang.IllegalArgumentException is not thrown"); } catch(java.lang.IllegalArgumentException iae) { //expected + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch(SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); } try { @@ -552,6 +562,54 @@ public class SAXParserTest extends TestCase { parser.parse(is, (HandlerBase) null); } catch(java.lang.IllegalArgumentException iae) { fail("java.lang.IllegalArgumentException is thrown"); + } catch (FileNotFoundException fne) { + fail("Unexpected FileNotFoundException " + fne.toString()); + } catch(IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch(SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); + } + + // Reader case + try { + InputSource is = new InputSource(new InputStreamReader( + new FileInputStream(list_wf[0]))); + parser.parse(is, (HandlerBase) null); + } catch(java.lang.IllegalArgumentException iae) { + fail("java.lang.IllegalArgumentException is thrown"); + } catch (FileNotFoundException fne) { + fail("Unexpected FileNotFoundException " + fne.toString()); + } catch(IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch(SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); + } + + // SystemID case + try { + InputSource is = new InputSource(list_wf[0].toURI().toString()); + parser.parse(is, (HandlerBase) null); + } catch(java.lang.IllegalArgumentException iae) { + fail("java.lang.IllegalArgumentException is thrown"); + } catch (FileNotFoundException fne) { + fail("Unexpected FileNotFoundException " + fne.toString()); + } catch(IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch(SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); + } + + // Inject IOException + try { + InputStream is = new BrokenInputStream( + new FileInputStream(list_wf[0]), 10); + parser.parse(is, (HandlerBase) null, + SAXParserTestSupport.XML_SYSTEM_ID); + fail("IOException expected"); + } catch(IOException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); } } @@ -559,15 +617,12 @@ public class SAXParserTest extends TestCase { * @test javax.xml.parsers.SAXParser#parse(java.io.InputStream, * org.xml.sax.helpers.DefaultHandler) */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify IOException.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify IOException.", + method = "parse", + args = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class} + ) public void _test_parseLjava_io_InputStreamLorg_xml_sax_helpers_DefaultHandler() throws Exception { @@ -612,25 +667,27 @@ public class SAXParserTest extends TestCase { * @test javax.xml.parsers.SAXParser#parse(java.io.InputStream, * org.xml.sax.helpers.DefaultHandler, java.lang.String) */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify IOException.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class, java.lang.String.class} - ) - }) - public void _test_parseLjava_io_InputStreamLorg_xml_sax_helpers_DefaultHandlerLjava_lang_String() - throws Exception { + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify IOException.", + method = "parse", + args = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class, java.lang.String.class} + ) + public void _test_parseLjava_io_InputStreamLorg_xml_sax_helpers_DefaultHandlerLjava_lang_String() { for(int i = 0; i < list_wf.length; i++) { - - HashMap<String, String> hm = new SAXParserTestSupport().readFile( - list_out_dh[i].getPath()); - MyDefaultHandler dh = new MyDefaultHandler(); - InputStream is = new FileInputStream(list_wf[i]); - parser.parse(is, dh, SAXParserTestSupport.XML_SYSTEM_ID); - assertTrue(SAXParserTestSupport.equalsMaps(hm, dh.createData())); + try { + HashMap<String, String> hm = sp.readFile( + list_out_hb[i].getPath()); + MyDefaultHandler dh = new MyDefaultHandler(); + InputStream is = new FileInputStream(list_wf[i]); + parser.parse(is, dh, SAXParserTestSupport.XML_SYSTEM_ID); + assertTrue(SAXParserTestSupport.equalsMaps(hm, + dh.createData())); + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch (SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); + } } for(int i = 0; i < list_nwf.length; i++) { @@ -641,16 +698,24 @@ public class SAXParserTest extends TestCase { fail("SAXException is not thrown"); } catch(org.xml.sax.SAXException se) { //expected + } catch (FileNotFoundException fne) { + fail("Unexpected FileNotFoundException " + fne.toString()); + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); } } try { MyDefaultHandler dh = new MyDefaultHandler(); - parser.parse((InputStream) null, dh, + parser.parse((InputStream) null, dh, SAXParserTestSupport.XML_SYSTEM_ID); fail("java.lang.IllegalArgumentException is not thrown"); } catch(java.lang.IllegalArgumentException iae) { //expected + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch(SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); } try { @@ -659,44 +724,86 @@ public class SAXParserTest extends TestCase { SAXParserTestSupport.XML_SYSTEM_ID); } catch(java.lang.IllegalArgumentException iae) { fail("java.lang.IllegalArgumentException is thrown"); - } - - // TODO commented out since our parser is nonvalidating and thus never - // tries to load staff.dtd in "/" ... and therefore never can fail with - // an IOException - /*try { - MyDefaultHandler dh = new MyDefaultHandler(); - InputStream is = new FileInputStream(list_wf[0]); - parser.parse(is, dh, "/"); - fail("Expected IOException was not thrown"); + } catch (FileNotFoundException fne) { + fail("Unexpected FileNotFoundException " + fne.toString()); } catch(IOException ioe) { - // expected - }*/ + fail("Unexpected IOException " + ioe.toString()); + } catch(SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); + } +// +// for(int i = 0; i < list_wf.length; i++) { +// +// HashMap<String, String> hm = new SAXParserTestSupport().readFile( +// list_out_dh[i].getPath()); +// MyDefaultHandler dh = new MyDefaultHandler(); +// InputStream is = new FileInputStream(list_wf[i]); +// parser.parse(is, dh, SAXParserTestSupport.XML_SYSTEM_ID); +// assertTrue(SAXParserTestSupport.equalsMaps(hm, dh.createData())); +// } +// +// for(int i = 0; i < list_nwf.length; i++) { +// try { +// MyDefaultHandler dh = new MyDefaultHandler(); +// InputStream is = new FileInputStream(list_nwf[i]); +// parser.parse(is, dh, SAXParserTestSupport.XML_SYSTEM_ID); +// fail("SAXException is not thrown"); +// } catch(org.xml.sax.SAXException se) { +// //expected +// } +// } +// +// try { +// MyDefaultHandler dh = new MyDefaultHandler(); +// parser.parse((InputStream) null, dh, +// SAXParserTestSupport.XML_SYSTEM_ID); +// fail("java.lang.IllegalArgumentException is not thrown"); +// } catch(java.lang.IllegalArgumentException iae) { +// //expected +// } +// +// try { +// InputStream is = new FileInputStream(list_wf[0]); +// parser.parse(is, (DefaultHandler) null, +// SAXParserTestSupport.XML_SYSTEM_ID); +// } catch(java.lang.IllegalArgumentException iae) { +// fail("java.lang.IllegalArgumentException is thrown"); +// } +// +// // TODO commented out since our parser is nonvalidating and thus never +// // tries to load staff.dtd in "/" ... and therefore never can fail with +// // an IOException +// /*try { +// MyDefaultHandler dh = new MyDefaultHandler(); +// InputStream is = new FileInputStream(list_wf[0]); +// parser.parse(is, dh, "/"); +// fail("Expected IOException was not thrown"); +// } catch(IOException ioe) { +// // expected +// }*/ } - /** - * @test javax.xml.parsers.SAXParser#parse(java.io.InputStream, - * org.xml.sax.HandlerBase) - */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify positive functionality properly; " + - "not all exceptions are verified.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.InputStream.class, org.xml.sax.HandlerBase.class} - ) - }) - @SuppressWarnings("deprecation") - public void _test_parseLjava_io_InputStreamLorg_xml_sax_HandlerBase() - throws Exception { + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "Sufficient while XML parser situation is still unclear", + method = "parse", + args = {java.io.InputStream.class, org.xml.sax.HandlerBase.class} + ) + public void testParseInputStreamHandlerBase() { for(int i = 0; i < list_wf.length; i++) { - HashMap<String, String> hm = sp.readFile(list_out_hb[i].getPath()); - MyHandler dh = new MyHandler(); - InputStream is = new FileInputStream(list_wf[i]); - parser.parse(is, dh); - assertTrue(SAXParserTestSupport.equalsMaps(hm, dh.createData())); + try { + HashMap<String, String> hm = sp.readFile( + list_out_hb[i].getPath()); + MyHandler dh = new MyHandler(); + InputStream is = new FileInputStream(list_wf[i]); + parser.parse(is, dh); + assertTrue(SAXParserTestSupport.equalsMaps(hm, + dh.createData())); + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch (SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); + } } for(int i = 0; i < list_nwf.length; i++) { @@ -707,6 +814,10 @@ public class SAXParserTest extends TestCase { fail("SAXException is not thrown"); } catch(org.xml.sax.SAXException se) { //expected + } catch (FileNotFoundException fne) { + fail("Unexpected FileNotFoundException " + fne.toString()); + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); } } @@ -716,6 +827,10 @@ public class SAXParserTest extends TestCase { fail("java.lang.IllegalArgumentException is not thrown"); } catch(java.lang.IllegalArgumentException iae) { //expected + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch(SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); } try { @@ -723,24 +838,34 @@ public class SAXParserTest extends TestCase { parser.parse(is, (HandlerBase) null); } catch(java.lang.IllegalArgumentException iae) { fail("java.lang.IllegalArgumentException is thrown"); + } catch (FileNotFoundException fne) { + fail("Unexpected FileNotFoundException " + fne.toString()); + } catch(IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch(SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); + } + + // Inject IOException + try { + InputStream is = new BrokenInputStream( + new FileInputStream(list_wf[0]), 10); + parser.parse(is, (HandlerBase) null); + fail("IOException expected"); + } catch(IOException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); } } - /** - * @test javax.xml.parsers.SAXParser#parse(java.io.InputStream, - * org.xml.sax.HandlerBase, java.lang.String) - */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.InputStream.class, org.xml.sax.HandlerBase.class, java.lang.String.class} - ) - }) - @SuppressWarnings("deprecation") - public void _test_parseLjava_io_InputStreamLorg_xml_sax_HandlerBaseLjava_lang_String() { + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "Sufficient while XML parser situation is still unclear", + method = "parse", + args = {java.io.InputStream.class, org.xml.sax.HandlerBase.class, java.lang.String.class} + ) + public void testParseInputStreamHandlerBaseString() { for(int i = 0; i < list_wf.length; i++) { try { HashMap<String, String> hm = sp.readFile( @@ -798,36 +923,31 @@ public class SAXParserTest extends TestCase { } catch(SAXException sax) { fail("Unexpected SAXException " + sax.toString()); } - - // TODO commented out since our parser is nonvalidating and thus never - // tries to load staff.dtd in "/" ... and therefore never can fail with - // an IOException - /*try { - MyHandler dh = new MyHandler(); - InputStream is = new FileInputStream(list_wf[0]); - parser.parse(is, dh, "/"); - fail("Expected IOException was not thrown"); - } catch (IOException ioe) { - // expected - } catch (SAXException sax) { - fail("Unexpected SAXException " + sax.toString()); - }*/ - + + // Inject IOException + try { + InputStream is = new BrokenInputStream( + new FileInputStream(list_wf[0]), 10); + parser.parse(is, (HandlerBase) null, + SAXParserTestSupport.XML_SYSTEM_ID); + fail("IOException expected"); + } catch(IOException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } } /** * @test javax.xml.parsers.SAXParser#parse(java.lang.String, * org.xml.sax.helpers.DefaultHandler) */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify IOException.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.lang.String.class, org.xml.sax.helpers.DefaultHandler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify IOException.", + method = "parse", + args = {java.lang.String.class, org.xml.sax.helpers.DefaultHandler.class} + ) public void _test_parseLjava_lang_StringLorg_xml_sax_helpers_DefaultHandler() throws Exception { @@ -865,36 +985,39 @@ public class SAXParserTest extends TestCase { } } - /** - * @tests javax.xml.parsers.SAXParser#parse(java.lang.String, - * org.xml.sax.HandlerBase) - */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify IOException.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.lang.String.class, org.xml.sax.HandlerBase.class} - ) - }) - @SuppressWarnings("deprecation") - public void _test_parseLjava_lang_StringLorg_xml_sax_HandlerBase() - throws Exception { + @TestTargetNew( + level = TestLevel.SUFFICIENT, + notes = "Sufficient while XML parser situation is still unclear", + method = "parse", + args = {java.lang.String.class, org.xml.sax.HandlerBase.class} + ) + public void testParseStringHandlerBase() { for(int i = 0; i < list_wf.length; i++) { - HashMap<String, String> hm = sp.readFile(list_out_hb[i].getPath()); - MyHandler dh = new MyHandler(); - parser.parse(list_wf[i].getPath(), dh); - assertTrue(SAXParserTestSupport.equalsMaps(hm, dh.createData())); + try { + HashMap<String, String> hm = sp.readFile( + list_out_hb[i].getPath()); + MyHandler dh = new MyHandler(); + parser.parse(list_wf[i].toURI().toString(), dh); + assertTrue(SAXParserTestSupport.equalsMaps(hm, + dh.createData())); + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch (SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); + } } for(int i = 0; i < list_nwf.length; i++) { try { MyHandler dh = new MyHandler(); - parser.parse(list_nwf[i].getPath(), dh); + parser.parse(list_nwf[i].toURI().toString(), dh); fail("SAXException is not thrown"); } catch(org.xml.sax.SAXException se) { //expected + } catch (FileNotFoundException fne) { + fail("Unexpected FileNotFoundException " + fne.toString()); + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); } } @@ -904,39 +1027,145 @@ public class SAXParserTest extends TestCase { fail("java.lang.IllegalArgumentException is not thrown"); } catch(java.lang.IllegalArgumentException iae) { //expected + } catch (IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch(SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); } try { - parser.parse(list_wf[0].getPath(), (HandlerBase) null); + parser.parse(list_wf[0].toURI().toString(), (HandlerBase) null); } catch(java.lang.IllegalArgumentException iae) { fail("java.lang.IllegalArgumentException is thrown"); + } catch (FileNotFoundException fne) { + fail("Unexpected FileNotFoundException " + fne.toString()); + } catch(IOException ioe) { + fail("Unexpected IOException " + ioe.toString()); + } catch(SAXException sax) { + fail("Unexpected SAXException " + sax.toString()); } } - /** - * @tests javax.xml.parsers.SAXParser#reset(). - */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't check that SAXParser is reset to the same state " + - "as it was created.", - targets = { - @TestTarget( - methodName = "reset", - methodArgs = {} - ) - }) - public void _test_reset() { + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "reset", + args = { } + ) + @KnownFailure("Android DocumentBuilder should implement reset() properly") + public void testReset() { try { spf = SAXParserFactory.newInstance(); parser = spf.newSAXParser(); + + parser.setProperty(LEXICAL_HANDLER_PROPERTY, new MockHandler(new MethodLogger())); parser.reset(); - } catch (ParserConfigurationException pce) { - fail("Unexpected ParserConfigurationException " + pce.toString()); - } catch(SAXException se) { - fail("Unexpected SAXException " + se.toString()); + assertEquals(null, parser.getProperty(LEXICAL_HANDLER_PROPERTY)); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getParser", + args = { } + ) + public void testGetParser() { + spf = SAXParserFactory.newInstance(); + try { + Parser parser = spf.newSAXParser().getParser(); + assertNotNull(parser); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getXMLReader", + args = { } + ) + public void testGetReader() { + spf = SAXParserFactory.newInstance(); + try { + XMLReader reader = spf.newSAXParser().getXMLReader(); + assertNotNull(reader); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); } } + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getProperty", + args = { String.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setProperty", + args = { String.class, Object.class } + ) + }) + @KnownFailure("ExpatParser should allow to clear properties") + public void testSetGetProperty() { + // Ordinary case + String validName = "http://xml.org/sax/properties/lexical-handler"; + LexicalHandler validValue = new MockHandler(new MethodLogger()); + + try { + SAXParser parser = spf.newSAXParser(); + parser.setProperty(validName, validValue); + assertEquals(validValue, parser.getProperty(validName)); + + parser.setProperty(validName, null); + assertEquals(null, parser.getProperty(validName)); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + // Unsupported property + try { + SAXParser parser = spf.newSAXParser(); + parser.setProperty("foo", "bar"); + fail("SAXNotRecognizedException expected"); + } catch (SAXNotRecognizedException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + try { + SAXParser parser = spf.newSAXParser(); + parser.getProperty("foo"); + fail("SAXNotRecognizedException expected"); + } catch (SAXNotRecognizedException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + // No name case + try { + SAXParser parser = spf.newSAXParser(); + parser.setProperty(null, "bar"); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + try { + SAXParser parser = spf.newSAXParser(); + parser.getProperty(null); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + } } + diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTestSupport.java b/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTestSupport.java index 56b5501..bc5e6a1 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTestSupport.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTestSupport.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,6 +16,12 @@ package tests.api.javax.xml.parsers; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; + import org.xml.sax.Attributes; import org.xml.sax.HandlerBase; import org.xml.sax.InputSource; @@ -23,11 +29,6 @@ import org.xml.sax.Locator; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; - /** * Support for SAXParserTest. Shares the element keys used in the golden files. * Compares the result of the parser with golden data. @@ -73,6 +74,16 @@ class SAXParserTestSupport { KEY_SKIPPED_ENTITY, KEY_START_ELEMENT, KEY_START_PREFIX_MAPPING}; + static { + String tmp = System.getProperty("java.io.tmpdir", "."); + + new File(tmp).mkdirs(); + new File(tmp, XML_WF).mkdirs(); + new File(tmp, XML_NWF).mkdirs(); + new File(tmp, XML_WF_OUT_DH).mkdirs(); + new File(tmp, XML_WF_OUT_HB).mkdirs(); + } + /** * Initialize the SAXParserTest reference by filling in the data from the * file passed to the method. This will be the reference to compare diff --git a/xml/src/test/java/tests/api/org/xml/sax/AllTests.java b/xml/src/test/java/tests/api/org/xml/sax/AllTests.java new file mode 100644 index 0000000..9c29178 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/AllTests.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTests { + + public static void main(String[] args) { + junit.textui.TestRunner.run(AllTests.suite()); + } + + public static Test suite() { + TestSuite suite = tests.TestSuiteFactory.createTestSuite("Tests for org.xml.sax package"); + // $JUnit-BEGIN$ + + suite.addTestSuite(HandlerBaseTest.class); + suite.addTestSuite(InputSourceTest.class); + suite.addTestSuite(SAXExceptionTest.class); + suite.addTestSuite(SAXNotRecognizedExceptionTest.class); + suite.addTestSuite(SAXNotSupportedExceptionTest.class); + suite.addTestSuite(SAXParseExceptionTest.class); + + suite.addTest(tests.api.org.xml.sax.ext.AllTests.suite()); + suite.addTest(tests.api.org.xml.sax.helpers.AllTests.suite()); + + // $JUnit-END$ + return suite; + } +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/HandlerBaseTest.java b/xml/src/test/java/tests/api/org/xml/sax/HandlerBaseTest.java new file mode 100644 index 0000000..7c7f591 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/HandlerBaseTest.java @@ -0,0 +1,226 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; + +import junit.framework.TestCase; + +import org.xml.sax.AttributeList; +import org.xml.sax.HandlerBase; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.helpers.AttributeListImpl; +import org.xml.sax.helpers.LocatorImpl; + +@SuppressWarnings("deprecation") +@TestTargetClass(HandlerBase.class) +public class HandlerBaseTest extends TestCase { + + /* + * Note: most of the tests have to check for an empty implementation of the + * respective methods and, as a result, are somewhat trivial. + */ + + private HandlerBase h = new HandlerBase(); + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "resolveEntity", + args = { String.class, String.class } + ) + public void testResolveEntity() { + try { + h.resolveEntity("publicID", "systemID"); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "notationDecl", + args = { String.class, String.class, String.class } + ) + public void testNotationDecl() { + h.notationDecl("name", "publicID", "systemID"); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "unparsedEntityDecl", + args = { String.class, String.class, String.class, String.class } + ) + public void testUnparsedEntityDecl() { + h.unparsedEntityDecl("name", "publicID", "systemID", "notationName"); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setDocumentLocator", + args = { org.xml.sax.Locator.class } + ) + public void testSetDocumentLocator() { + h.setDocumentLocator(new LocatorImpl()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startDocument", + args = { } + ) + public void testStartDocument() { + try { + h.startDocument(); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endDocument", + args = { } + ) + public void testEndDocument() { + try { + h.endDocument(); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startElement", + args = { String.class, AttributeList.class } + ) + public void testStartElement() { + try { + h.startElement("name", new AttributeListImpl()); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endElement", + args = { String.class } + ) + public void testEndElement() { + try { + h.endElement("name"); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "characters", + args = { char[].class, int.class, int.class } + ) + public void testCharacters() { + try { + h.characters("The quick brown fox".toCharArray(), 4, 11); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "ignorableWhitespace", + args = { char[].class, int.class, int.class } + ) + public void testIgnorableWhitespace() { + try { + h.ignorableWhitespace(" ".toCharArray(), 4, 11); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "processingInstruction", + args = { String.class, String.class } + ) + public void testProcessingInstruction() { + try { + h.processingInstruction("target", "data"); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "warning", + args = { org.xml.sax.SAXParseException.class } + ) + public void testWarning() { + try { + h.warning(new SAXParseException("Foo", new LocatorImpl())); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "error", + args = { org.xml.sax.SAXParseException.class } + ) + public void testError() { + try { + h.error(new SAXParseException("Foo", new LocatorImpl())); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "fatalError", + args = { org.xml.sax.SAXParseException.class } + ) + public void testFatalError() { + // Ordinary case + try { + h.fatalError(new SAXParseException("Foo", new LocatorImpl())); + fail("SAXException expected"); + } catch (SAXException e) { + // Expected + } + + // No exception + try { + h.fatalError(null); + fail("NullPointerException expected"); + } catch (SAXException e) { + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected + } + + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/InputSourceTest.java b/xml/src/test/java/tests/api/org/xml/sax/InputSourceTest.java new file mode 100644 index 0000000..7c73b52 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/InputSourceTest.java @@ -0,0 +1,254 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.Reader; +import java.io.StringReader; + +import junit.framework.TestCase; + +import org.xml.sax.InputSource; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; +import dalvik.annotation.TestTargets; + +@TestTargetClass(InputSource.class) +public class InputSourceTest extends TestCase { + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "InputSource", + args = { } + ) + public void testInputSource() { + InputSource i = new InputSource(); + + assertNull(i.getByteStream()); + assertNull(i.getCharacterStream()); + assertNull(i.getEncoding()); + assertNull(i.getPublicId()); + assertNull(i.getSystemId()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "InputSource", + args = { String.class } + ) + public void testInputSourceString() { + InputSource i = new InputSource("Foo"); + + assertNull(i.getByteStream()); + assertNull(i.getCharacterStream()); + assertNull(i.getEncoding()); + assertNull(i.getPublicId()); + assertEquals("Foo", i.getSystemId()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "InputSource", + args = { InputStream.class } + ) + public void testInputSourceInputStream() { + ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]); + + // Ordinary case + InputSource i = new InputSource(bais); + + assertEquals(bais, i.getByteStream()); + assertNull(i.getCharacterStream()); + assertNull(i.getEncoding()); + assertNull(i.getPublicId()); + assertNull(i.getSystemId()); + + // No input stream + i = new InputSource((InputStream)null); + + assertNull(i.getByteStream()); + assertNull(i.getCharacterStream()); + assertNull(i.getEncoding()); + assertNull(i.getPublicId()); + assertNull(i.getSystemId()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "InputSource", + args = { Reader.class } + ) + public void testInputSourceReader() { + StringReader sr = new StringReader("Hello, world."); + + // Ordinary case + InputSource i = new InputSource(sr); + + assertNull(i.getByteStream()); + assertEquals(sr, i.getCharacterStream()); + assertNull(i.getEncoding()); + assertNull(i.getPublicId()); + assertNull(i.getSystemId()); + + // No reader + i = new InputSource((Reader)null); + + assertNull(i.getByteStream()); + assertNull(i.getCharacterStream()); + assertNull(i.getEncoding()); + assertNull(i.getPublicId()); + assertNull(i.getSystemId()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setPublicId", + args = { String.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getPublicId", + args = { } + ) + }) + public void testSetPublicIdGetPublicId() { + InputSource i = new InputSource(); + + i.setPublicId("Foo"); + assertEquals("Foo", i.getPublicId()); + + i.setPublicId(null); + assertNull(i.getPublicId()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setSystemId", + args = { String.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getSystemId", + args = { } + ) + }) + public void testSetSystemIdGetSystemId() { + InputSource i = new InputSource(); + + i.setSystemId("Foo"); + assertEquals("Foo", i.getSystemId()); + + i.setSystemId(null); + assertNull(i.getSystemId()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setByteStream", + args = { InputStream.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getByteStream", + args = { } + ) + }) + public void testSetByteStreamGetByteStream() { + ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]); + + InputSource i = new InputSource(); + + // Ordinary case + i.setByteStream(bais); + + assertEquals(bais, i.getByteStream()); + + // No input stream + i.setByteStream(null); + + assertNull(i.getByteStream()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setEncoding", + args = { String.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getEncoding", + args = { } + ) + }) + public void testSetEncodingGetEncoding() { + InputSource i = new InputSource(); + + // Ordinary case + i.setEncoding("Klingon"); + + assertEquals("Klingon", i.getEncoding()); + + // No encoding + i.setEncoding(null); + + assertNull(i.getEncoding()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setCharacterStream", + args = { Reader.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getCharacterStream", + args = { } + ) + }) + public void testSetCharacterStreamGetCharacterStream() { + StringReader sr = new StringReader("Hello, world."); + + InputSource i = new InputSource(); + + // Ordinary case + i.setCharacterStream(sr); + + assertNull(i.getByteStream()); + assertEquals(sr, i.getCharacterStream()); + assertNull(i.getEncoding()); + assertNull(i.getPublicId()); + assertNull(i.getSystemId()); + + // No reader + i.setCharacterStream(null); + + assertNull(i.getByteStream()); + assertNull(i.getCharacterStream()); + assertNull(i.getEncoding()); + assertNull(i.getPublicId()); + assertNull(i.getSystemId()); + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/SAXExceptionTest.java b/xml/src/test/java/tests/api/org/xml/sax/SAXExceptionTest.java new file mode 100644 index 0000000..afc1f8d --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/SAXExceptionTest.java @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax; + +import junit.framework.TestCase; + +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; + +@TestTargetClass(SAXException.class) +public class SAXExceptionTest extends TestCase { + + public static final String ERR = "Houston, we have a problem"; + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "SAXException", + args = { } + ) + public void testSAXParseException() { + SAXException e = new SAXException(); + + assertNull(e.getMessage()); + assertNull(e.getException()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "SAXException", + args = { String.class, Exception.class } + ) + public void testSAXException_String_Exception() { + Exception c = new Exception(); + + // Ordinary case + SAXException e = new SAXException(ERR, c); + + assertEquals(ERR, e.getMessage()); + assertEquals(c, e.getException()); + + // No message + e = new SAXException(null, c); + + assertNull(e.getMessage()); + assertEquals(c, e.getException()); + + // No cause + e = new SAXParseException(ERR, null); + + assertEquals(ERR, e.getMessage()); + assertNull(e.getException()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "SAXException", + args = { String.class } + ) + public void testSAXException_String() { + // Ordinary case + SAXException e = new SAXException(ERR); + + assertEquals(ERR, e.getMessage()); + assertNull(e.getException()); + + // No message + e = new SAXException((String)null); + + assertNull(e.getMessage()); + assertNull(e.getException()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "SAXException", + args = { Exception.class } + ) + public void testSAXException_Exception() { + Exception c = new Exception(); + + // Ordinary case + SAXException e = new SAXException(c); + + assertNull(e.getMessage()); + assertEquals(c, e.getException()); + + // No cause + e = new SAXException((Exception)null); + + assertNull(e.getMessage()); + assertNull(e.getException()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "toString", + args = { } + ) + public void testToString() { + // Ordinary case + SAXException e = new SAXException(ERR); + String s = e.toString(); + + assertTrue(s.contains(ERR)); + + // No message + e = new SAXException(); + s = e.toString(); + + assertFalse(s.contains(ERR)); + } + +}
\ No newline at end of file diff --git a/xml/src/test/java/tests/api/org/xml/sax/SAXNotRecognizedExceptionTest.java b/xml/src/test/java/tests/api/org/xml/sax/SAXNotRecognizedExceptionTest.java new file mode 100644 index 0000000..1fab7bf --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/SAXNotRecognizedExceptionTest.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax; + +import junit.framework.TestCase; + +import org.xml.sax.SAXNotRecognizedException; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; + +@TestTargetClass(SAXNotRecognizedException.class) +public class SAXNotRecognizedExceptionTest extends TestCase { + + public static final String ERR = "Houston, we have a problem"; + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "SAXNotRecognizedException", + args = { } + ) + public void testSAXNotRecognizedException() { + SAXNotRecognizedException e = new SAXNotRecognizedException(); + assertNull(e.getMessage()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "SAXNotRecognizedException", + args = { String.class } + ) + public void testSAXNotRecognizedException_String() { + SAXNotRecognizedException e = new SAXNotRecognizedException(ERR); + assertEquals(ERR, e.getMessage()); + + e = new SAXNotRecognizedException(null); + assertNull(e.getMessage()); + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/SAXNotSupportedExceptionTest.java b/xml/src/test/java/tests/api/org/xml/sax/SAXNotSupportedExceptionTest.java new file mode 100644 index 0000000..9060a14 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/SAXNotSupportedExceptionTest.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; + +import junit.framework.TestCase; + +import org.xml.sax.SAXNotSupportedException; + +@TestTargetClass(SAXNotSupportedException.class) +public class SAXNotSupportedExceptionTest extends TestCase { + + public static final String ERR = "Houston, we have a problem"; + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "SAXNotSupportedException", + args = { } + ) + public void testSAXNotSupportedException() { + SAXNotSupportedException e = new SAXNotSupportedException(); + assertNull(e.getMessage()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "SAXNotSupportedException", + args = { String.class } + ) + public void testSAXNotSupportedException_String() { + SAXNotSupportedException e = new SAXNotSupportedException(ERR); + assertEquals(ERR, e.getMessage()); + + e = new SAXNotSupportedException(null); + assertNull(e.getMessage()); + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/SAXParseExceptionTest.java b/xml/src/test/java/tests/api/org/xml/sax/SAXParseExceptionTest.java new file mode 100644 index 0000000..aff0c7f --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/SAXParseExceptionTest.java @@ -0,0 +1,276 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax; + +import junit.framework.TestCase; + +import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; +import org.xml.sax.helpers.LocatorImpl; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; +import dalvik.annotation.TestTargets; + +@TestTargetClass(SAXParseException.class) +public class SAXParseExceptionTest extends TestCase { + + public static final String ERR = "Houston, we have a problem"; + + public static final String SYS = "mySystemID"; + + public static final String PUB = "myPublicID"; + + public static final int ROW = 1; + + public static final int COL = 2; + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "SAXParseException", + args = { String.class, Locator.class, Exception.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getMessage", + args = { } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getException", + args = { } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getPublicId", + args = { } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getSystemId", + args = { } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getLineNumber", + args = { } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getColumnNumber", + args = { } + ) + }) + public void testSAXParseException_String_Locator_Exception() { + LocatorImpl l = new LocatorImpl(); + l.setPublicId(PUB); + l.setSystemId(SYS); + l.setLineNumber(ROW); + l.setColumnNumber(COL); + + Exception c = new Exception(); + + // Ordinary case + SAXParseException e = new SAXParseException(ERR, l, c); + + assertEquals(ERR, e.getMessage()); + assertEquals(c, e.getException()); + + assertEquals(PUB, e.getPublicId()); + assertEquals(SYS, e.getSystemId()); + assertEquals(ROW, e.getLineNumber()); + assertEquals(COL, e.getColumnNumber()); + + // No message + e = new SAXParseException(null, l, c); + + assertNull(e.getMessage()); + assertEquals(c, e.getException()); + + assertEquals(PUB, e.getPublicId()); + assertEquals(SYS, e.getSystemId()); + assertEquals(ROW, e.getLineNumber()); + assertEquals(COL, e.getColumnNumber()); + + // No locator + e = new SAXParseException(ERR, null, c); + + assertEquals(ERR, e.getMessage()); + assertEquals(c, e.getException()); + + assertNull(e.getPublicId()); + assertNull(e.getSystemId()); + assertEquals(-1, e.getLineNumber()); + assertEquals(-1, e.getColumnNumber()); + + // No cause + e = new SAXParseException(ERR, l, null); + + assertEquals(ERR, e.getMessage()); + assertNull(e.getException()); + + assertEquals(PUB, e.getPublicId()); + assertEquals(SYS, e.getSystemId()); + assertEquals(ROW, e.getLineNumber()); + assertEquals(COL, e.getColumnNumber()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "SAXParseException", + args = { String.class, Locator.class } + ) + public void testSAXParseException_String_Locator() { + LocatorImpl l = new LocatorImpl(); + l.setPublicId(PUB); + l.setSystemId(SYS); + l.setLineNumber(ROW); + l.setColumnNumber(COL); + + // Ordinary case + SAXParseException e = new SAXParseException(ERR, l); + + assertEquals(ERR, e.getMessage()); + assertNull(e.getException()); + + assertEquals(PUB, e.getPublicId()); + assertEquals(SYS, e.getSystemId()); + assertEquals(ROW, e.getLineNumber()); + assertEquals(COL, e.getColumnNumber()); + + // No message + e = new SAXParseException(null, l); + + assertNull(e.getMessage()); + assertNull(e.getException()); + + assertEquals(PUB, e.getPublicId()); + assertEquals(SYS, e.getSystemId()); + assertEquals(ROW, e.getLineNumber()); + assertEquals(COL, e.getColumnNumber()); + + // No locator + e = new SAXParseException(ERR, null); + + assertEquals(ERR, e.getMessage()); + assertNull(e.getException()); + + assertNull(e.getPublicId()); + assertNull(e.getSystemId()); + assertEquals(-1, e.getLineNumber()); + assertEquals(-1, e.getColumnNumber()); + + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "SAXParseException", + args = { String.class, String.class, String.class, int.class, int.class, + Exception.class } + ) + public void testSAXParseException_String_String_String_int_int_Exception() { + Exception c = new Exception(); + + // Ordinary case + SAXParseException e = new SAXParseException(ERR, PUB, SYS, ROW, COL, c); + + assertEquals(ERR, e.getMessage()); + assertEquals(c, e.getException()); + + assertEquals(PUB, e.getPublicId()); + assertEquals(SYS, e.getSystemId()); + assertEquals(ROW, e.getLineNumber()); + assertEquals(COL, e.getColumnNumber()); + + // No message + e = new SAXParseException(null, PUB, SYS, ROW, COL, c); + + assertNull(e.getMessage()); + assertEquals(c, e.getException()); + + assertEquals(PUB, e.getPublicId()); + assertEquals(SYS, e.getSystemId()); + assertEquals(ROW, e.getLineNumber()); + assertEquals(COL, e.getColumnNumber()); + + // No locator + e = new SAXParseException(ERR, null, null, -1, -1, c); + + assertEquals(ERR, e.getMessage()); + assertEquals(c, e.getException()); + + assertNull(e.getPublicId()); + assertNull(e.getSystemId()); + assertEquals(-1, e.getLineNumber()); + assertEquals(-1, e.getColumnNumber()); + + // No cause + e = new SAXParseException(ERR, PUB, SYS, ROW, COL, null); + + assertEquals(ERR, e.getMessage()); + assertNull(e.getException()); + + assertEquals(PUB, e.getPublicId()); + assertEquals(SYS, e.getSystemId()); + assertEquals(ROW, e.getLineNumber()); + assertEquals(COL, e.getColumnNumber()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "SAXParseException", + args = { String.class, String.class, String.class, int.class, + int.class } + ) + public void testSAXParseException_String_String_String_int_int() { + // Ordinary case + SAXParseException e = new SAXParseException(ERR, PUB, SYS, ROW, COL); + + assertEquals(ERR, e.getMessage()); + assertNull(e.getException()); + + assertEquals(PUB, e.getPublicId()); + assertEquals(SYS, e.getSystemId()); + assertEquals(ROW, e.getLineNumber()); + assertEquals(COL, e.getColumnNumber()); + + // No message + e = new SAXParseException(null, PUB, SYS, ROW, COL); + + assertNull(e.getMessage()); + assertNull(e.getException()); + + assertEquals(PUB, e.getPublicId()); + assertEquals(SYS, e.getSystemId()); + assertEquals(ROW, e.getLineNumber()); + assertEquals(COL, e.getColumnNumber()); + + // No locator + e = new SAXParseException(ERR, null, null, -1, -1); + + assertEquals(ERR, e.getMessage()); + assertNull(e.getException()); + + assertNull(e.getPublicId()); + assertNull(e.getSystemId()); + assertEquals(-1, e.getLineNumber()); + assertEquals(-1, e.getColumnNumber()); + } + +}
\ No newline at end of file diff --git a/xml/src/test/java/tests/java/xml/AllTests.java b/xml/src/test/java/tests/api/org/xml/sax/ext/AllTests.java index f6e2540..f4b34b8 100644 --- a/xml/src/test/java/tests/java/xml/AllTests.java +++ b/xml/src/test/java/tests/api/org/xml/sax/ext/AllTests.java @@ -1,12 +1,12 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -14,14 +14,11 @@ * limitations under the License. */ -package tests.java.xml; +package tests.api.org.xml.sax.ext; import junit.framework.Test; import junit.framework.TestSuite; -/** - * Test suite that includes all tests for the XML project. - */ public class AllTests { public static void main(String[] args) { @@ -29,9 +26,13 @@ public class AllTests { } public static Test suite() { - TestSuite suite = new TestSuite("All XML test suites"); + TestSuite suite = tests.TestSuiteFactory.createTestSuite("Tests for org.xml.sax.ext package"); // $JUnit-BEGIN$ - suite.addTest(tests.xml.AllTests.suite()); + + suite.addTestSuite(Attributes2ImplTest.class); + suite.addTestSuite(DefaultHandler2Test.class); + suite.addTestSuite(Locator2ImplTest.class); + // $JUnit-END$ return suite; } diff --git a/xml/src/test/java/tests/api/org/xml/sax/ext/Attributes2ImplTest.java b/xml/src/test/java/tests/api/org/xml/sax/ext/Attributes2ImplTest.java new file mode 100644 index 0000000..cd1b872 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/ext/Attributes2ImplTest.java @@ -0,0 +1,477 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.ext; + +import junit.framework.TestCase; + +import org.xml.sax.Attributes; +import org.xml.sax.ext.Attributes2Impl; +import org.xml.sax.helpers.AttributesImpl; + +import dalvik.annotation.KnownFailure; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; + +@TestTargetClass(Attributes2Impl.class) +public class Attributes2ImplTest extends TestCase { + + // Note: The original SAX2 implementation of Attributes2Impl is + // severely broken. Thus all of these tests will probably fail + // unless the Android implementation of the class gets fixed. + + private Attributes2Impl empty = new Attributes2Impl(); + + private Attributes2Impl multi = new Attributes2Impl(); + + private Attributes2Impl cdata = new Attributes2Impl(); + + @Override + public void setUp() { + multi.addAttribute("http://some.uri", "foo", "ns1:foo", + "string", "abc"); + multi.addAttribute("http://some.uri", "bar", "ns1:bar", + "string", "xyz"); + multi.addAttribute("http://some.other.uri", "answer", "ns2:answer", + "int", "42"); + multi.addAttribute("http://yet.another.uri", "gabba", "ns3:gabba", + "string", "gabba"); + + multi.setDeclared(0, false); + multi.setSpecified(0, false); + + multi.setDeclared(1, true); + multi.setSpecified(1, false); + + multi.setDeclared(2, false); + multi.setSpecified(2, true); + + multi.setDeclared(3, true); + multi.setSpecified(3, true); + + cdata.addAttribute("http://yet.another.uri", "hey", "ns3:hey", + "CDATA", "hey"); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setAttributes", + args = { Attributes.class } + ) + @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.") + public void testSetAttributes() { + // Ordinary case with Attributes2Impl + Attributes2Impl attrs = new Attributes2Impl(); + attrs.addAttribute("", "", "john", "string", "doe"); + + attrs.setAttributes(empty); + assertEquals(0, attrs.getLength()); + + attrs.setAttributes(multi); + for (int i = 0; i < multi.getLength(); i++) { + assertEquals(multi.getURI(i), attrs.getURI(i)); + assertEquals(multi.getLocalName(i), attrs.getLocalName(i)); + assertEquals(multi.getQName(i), attrs.getQName(i)); + assertEquals(multi.getType(i), attrs.getType(i)); + assertEquals(multi.getValue(i), attrs.getValue(i)); + assertEquals(multi.isDeclared(i), attrs.isDeclared(i)); + assertEquals(multi.isSpecified(i), attrs.isSpecified(i)); + } + + attrs.setAttributes(empty); + assertEquals(0, attrs.getLength()); + + // Ordinary case with AttributesImpl + attrs.setAttributes(new AttributesImpl(multi)); + assertEquals(multi.getLength(), attrs.getLength()); + + for (int i = 0; i < multi.getLength(); i++) { + assertEquals(multi.getURI(i), attrs.getURI(i)); + assertEquals(multi.getLocalName(i), attrs.getLocalName(i)); + assertEquals(multi.getQName(i), attrs.getQName(i)); + assertEquals(multi.getType(i), attrs.getType(i)); + assertEquals(multi.getValue(i), attrs.getValue(i)); + assertEquals(true, attrs.isDeclared(i)); + assertEquals(true, attrs.isSpecified(i)); + } + + // Special case with CDATA + attrs.setAttributes(new AttributesImpl(cdata)); + assertEquals(1, attrs.getLength()); + assertEquals(false, attrs.isDeclared(0)); + assertEquals(true, attrs.isSpecified(0)); + + // null case + try { + attrs.setAttributes(null); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "addAttribute", + args = { String.class, String.class, String.class, String.class, + String.class } + ) + @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.") + public void testAddAttribute() { + Attributes2Impl attrs = new Attributes2Impl(); + + // Ordinary case + attrs.addAttribute("http://yet.another.uri", "doe", "john:doe", + "string", "abc"); + + assertEquals(1, attrs.getLength()); + + assertEquals("http://yet.another.uri", attrs.getURI(0)); + assertEquals("doe", attrs.getLocalName(0)); + assertEquals("john:doe", attrs.getQName(0)); + assertEquals("string", attrs.getType(0)); + assertEquals("abc", attrs.getValue(0)); + + assertEquals(true, attrs.isDeclared(0)); + assertEquals(true, attrs.isSpecified(0)); + + // CDATA case + attrs.addAttribute("http://yet.another.uri", "doe", "jane:doe", + "CDATA", "abc"); + + assertEquals(2, attrs.getLength()); + + assertEquals("http://yet.another.uri", attrs.getURI(1)); + assertEquals("doe", attrs.getLocalName(1)); + assertEquals("jane:doe", attrs.getQName(1)); + assertEquals("CDATA", attrs.getType(1)); + assertEquals("abc", attrs.getValue(1)); + + assertEquals(false, attrs.isDeclared(1)); + assertEquals(true, attrs.isSpecified(1)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "removeAttribute", + args = { int.class } + ) + @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.") + public void testRemoveAttribute() { + Attributes2Impl attrs = new Attributes2Impl(multi); + + // Ordinary case + attrs.removeAttribute(1); + + assertEquals(3, attrs.getLength()); + + assertEquals(multi.getURI(0), attrs.getURI(0)); + assertEquals(multi.getLocalName(0), attrs.getLocalName(0)); + assertEquals(multi.getQName(0), attrs.getQName(0)); + assertEquals(multi.getType(0), attrs.getType(0)); + assertEquals(multi.getValue(0), attrs.getValue(0)); + assertEquals(multi.isDeclared(0), attrs.isDeclared(0)); + assertEquals(multi.isSpecified(0), attrs.isSpecified(0)); + + assertEquals(multi.getURI(2), attrs.getURI(1)); + assertEquals(multi.getLocalName(2), attrs.getLocalName(1)); + assertEquals(multi.getQName(2), attrs.getQName(1)); + assertEquals(multi.getType(2), attrs.getType(1)); + assertEquals(multi.getValue(2), attrs.getValue(1)); + assertEquals(multi.isDeclared(2), attrs.isDeclared(1)); + assertEquals(multi.isSpecified(2), attrs.isSpecified(1)); + + // Out of range + try { + attrs.removeAttribute(-1); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + + try { + attrs.removeAttribute(3); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "Attributes2Impl", + args = { } + ) + @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.") + public void testAttributes2Impl() { + assertEquals(0, empty.getLength()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "Attributes2Impl", + args = { Attributes.class } + ) + @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.") + public void testAttributes2ImplAttributes() { + // Ordinary case with Attributes2Impl + Attributes2Impl attrs = new Attributes2Impl(multi); + assertEquals(multi.getLength(), attrs.getLength()); + + for (int i = 0; i < multi.getLength(); i++) { + assertEquals(multi.getURI(i), attrs.getURI(i)); + assertEquals(multi.getLocalName(i), attrs.getLocalName(i)); + assertEquals(multi.getQName(i), attrs.getQName(i)); + assertEquals(multi.getType(i), attrs.getType(i)); + assertEquals(multi.getValue(i), attrs.getValue(i)); + assertEquals(multi.isDeclared(i), attrs.isDeclared(i)); + assertEquals(multi.isSpecified(i), attrs.isSpecified(i)); + } + + attrs = new Attributes2Impl(empty); + assertEquals(0, attrs.getLength()); + + // Ordinary case with AttributesImpl + attrs = new Attributes2Impl(new AttributesImpl(multi)); + assertEquals(multi.getLength(), attrs.getLength()); + + for (int i = 0; i < multi.getLength(); i++) { + assertEquals(multi.getURI(i), attrs.getURI(i)); + assertEquals(multi.getLocalName(i), attrs.getLocalName(i)); + assertEquals(multi.getQName(i), attrs.getQName(i)); + assertEquals(multi.getType(i), attrs.getType(i)); + assertEquals(multi.getValue(i), attrs.getValue(i)); + assertEquals(true, attrs.isDeclared(i)); + assertEquals(true, attrs.isSpecified(i)); + } + + // Special case with CDATA + attrs = new Attributes2Impl(new AttributesImpl(cdata)); + assertEquals(1, attrs.getLength()); + assertEquals(false, attrs.isDeclared(0)); + assertEquals(true, attrs.isSpecified(0)); + + // null case + try { + attrs = new Attributes2Impl(null); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "isDeclared", + args = { int.class } + ) + @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.") + public void testIsDeclaredInt() { + // Ordinary cases + assertEquals(false, multi.isDeclared(0)); + assertEquals(true, multi.isDeclared(1)); + + // Out of range + try { + multi.isDeclared(-1); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + + try { + multi.isDeclared(4); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "isDeclared", + args = { String.class, String.class } + ) + @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.") + public void testIsDeclaredStringString() { + // Ordinary cases + assertEquals(false, multi.isDeclared("http://some.uri", "foo")); + assertEquals(true, multi.isDeclared("http://some.uri", "bar")); + + // Not found + try { + assertFalse(multi.isDeclared("not", "found")); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "isDeclared", + args = { String.class } + ) + @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.") + public void testIsDeclaredString() { + // Ordinary cases + assertEquals(false, multi.isDeclared("ns1:foo")); + assertEquals(true, multi.isDeclared("ns1:bar")); + + // Not found + try { + assertFalse(multi.isDeclared("notfound")); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "isSpecified", + args = { int.class } + ) + @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.") + public void testIsSpecifiedInt() { + // Ordinary cases + assertEquals(false, multi.isSpecified(1)); + assertEquals(true, multi.isSpecified(2)); + + // Out of range + try { + multi.isSpecified(-1); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + + try { + multi.isSpecified(4); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "isSpecified", + args = { String.class, String.class } + ) + @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.") + public void testIsSpecifiedStringString() { + // Ordinary cases + assertEquals(false, multi.isSpecified("http://some.uri", "bar")); + assertEquals(true, multi.isSpecified("http://some.other.uri", "answer")); + + // Not found + try { + assertFalse(multi.isSpecified("not", "found")); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "isSpecified", + args = { String.class } + ) + @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.") + public void testIsSpecifiedString() { + // Ordinary cases + assertEquals(false, multi.isSpecified("ns1:bar")); + assertEquals(true, multi.isSpecified("ns2:answer")); + + // Not found + try { + assertFalse(multi.isSpecified("notfound")); + fail("IllegalArgumentException expected"); + } catch (IllegalArgumentException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setDeclared", + args = { int.class, boolean.class } + ) + @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.") + public void testSetDeclared() { + // Ordinary cases + multi.setSpecified(0, false); + assertEquals(false, multi.isSpecified(0)); + + multi.setSpecified(0, true); + assertEquals(true, multi.isSpecified(0)); + + multi.setSpecified(0, false); + assertEquals(false, multi.isSpecified(0)); + + // Out of range + try { + multi.setSpecified(-1, true); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + + try { + multi.setSpecified(5, true); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setSpecified", + args = { int.class, boolean.class } + ) + @KnownFailure("SAX2 RI of Attributes2Impl severely broken; needs fixing.") + public void testSetSpecified() { + // Ordinary cases + multi.setSpecified(0, false); + assertEquals(false, multi.isSpecified(0)); + + multi.setSpecified(0, true); + assertEquals(true, multi.isSpecified(0)); + + multi.setSpecified(0, false); + assertEquals(false, multi.isSpecified(0)); + + // Out of range + try { + multi.setSpecified(-1, true); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + + try { + multi.setSpecified(5, true); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/ext/DefaultHandler2Test.java b/xml/src/test/java/tests/api/org/xml/sax/ext/DefaultHandler2Test.java new file mode 100644 index 0000000..52a5972 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/ext/DefaultHandler2Test.java @@ -0,0 +1,234 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.ext; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; + +import junit.framework.TestCase; + +import org.xml.sax.SAXException; +import org.xml.sax.ext.DefaultHandler2; + +import java.io.IOException; + +@TestTargetClass(DefaultHandler2.class) +public class DefaultHandler2Test extends TestCase { + + private DefaultHandler2 h = new DefaultHandler2(); + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "DefaultHandler2", + args = { } + ) + public void testDefaultHandler2() { + new DefaultHandler2(); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startCDATA", + args = { } + ) + public void testStartCDATA() { + try { + h.startCDATA(); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endCDATA", + args = { } + ) + public void testEndCDATA() { + try { + h.endCDATA(); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startDTD", + args = { String.class, String.class, String.class } + ) + public void testStartDTD() { + try { + h.startDTD("name", "publicId", "systemId"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endDTD", + args = { } + ) + public void testEndDTD() { + try { + h.endDTD(); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startEntity", + args = { String.class } + ) + public void testStartEntity() { + try { + h.startEntity("name"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endEntity", + args = { String.class } + ) + public void testEndEntity() { + try { + h.endEntity("name"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "comment", + args = { char[].class, int.class, int.class } + ) + public void testComment() { + try { + h.comment("<!-- Comment -->".toCharArray(), 0, 15); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "attributeDecl", + args = { String.class, String.class, String.class, String.class, + String.class } + ) + public void testAttributeDecl() { + try { + h.attributeDecl("eName", "aName", "type", "mode", "value"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "elementDecl", + args = { String.class, String.class } + ) + public void testElementDecl() { + try { + h.elementDecl("name", "model"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "externalEntityDecl", + args = { String.class, String.class, String.class } + ) + public void testExternalEntityDecl() { + try { + h.externalEntityDecl("name", "publicId", "systemId"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "internalEntityDecl", + args = { String.class, String.class } + ) + public void testInternalEntityDecl() { + try { + h.internalEntityDecl("name", "value"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getExternalSubset", + args = { String.class, String.class } + ) + public void testGetExternalSubset() { + try { + assertNull(h.getExternalSubset("name", "http://some.uri")); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (IOException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "resolveEntity", + args = { String.class, String.class } + ) + public void testResolveEntityStringString() { + try { + assertNull(h.resolveEntity("publicId", "systemId")); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (IOException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "resolveEntity", + args = { String.class, String.class, String.class, String.class } + ) + public void testResolveEntityStringStringStringString() { + try { + assertNull(h.resolveEntity("name", "publicId", "http://some.uri", + "systemId")); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (IOException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/ext/Locator2ImplTest.java b/xml/src/test/java/tests/api/org/xml/sax/ext/Locator2ImplTest.java new file mode 100644 index 0000000..b018f59 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/ext/Locator2ImplTest.java @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.ext; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; +import dalvik.annotation.TestTargets; + +import junit.framework.TestCase; + +import org.xml.sax.Locator; +import org.xml.sax.ext.Locator2Impl; +import org.xml.sax.helpers.LocatorImpl; + +@TestTargetClass(Locator2Impl.class) +public class Locator2ImplTest extends TestCase { + + public static final String SYS = "mySystemID"; + + public static final String PUB = "myPublicID"; + + public static final int ROW = 1; + + public static final int COL = 2; + + public static final String ENC = "Klingon"; + + public static final String XML = "1.0"; + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "Locator2Impl", + args = { } + ) + public void testLocatorImpl() { + Locator2Impl l = new Locator2Impl(); + + assertEquals(null, l.getPublicId()); + assertEquals(null, l.getSystemId()); + assertEquals(0, l.getLineNumber()); + assertEquals(0, l.getColumnNumber()); + + assertEquals(null, l.getEncoding()); + assertEquals(null, l.getXMLVersion()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "Locator2Impl", + args = { Locator.class } + ) + public void testLocatorImplLocator() { + Locator2Impl inner = new Locator2Impl(); + + inner.setPublicId(PUB); + inner.setSystemId(SYS); + inner.setLineNumber(ROW); + inner.setColumnNumber(COL); + + inner.setEncoding(ENC); + inner.setXMLVersion(XML); + + // Ordinary case + Locator2Impl outer = new Locator2Impl(inner); + + assertEquals(PUB, outer.getPublicId()); + assertEquals(SYS, outer.getSystemId()); + assertEquals(ROW, outer.getLineNumber()); + assertEquals(COL, outer.getColumnNumber()); + + assertEquals(ENC, outer.getEncoding()); + assertEquals(XML, outer.getXMLVersion()); + + // Instance of old locator + outer = new Locator2Impl(new LocatorImpl(inner)); + + assertEquals(PUB, outer.getPublicId()); + assertEquals(SYS, outer.getSystemId()); + assertEquals(ROW, outer.getLineNumber()); + assertEquals(COL, outer.getColumnNumber()); + + assertEquals(null, outer.getEncoding()); + assertEquals(null, outer.getXMLVersion()); + + // No locator + try { + outer = new Locator2Impl(null); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected + } + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setXMLVersion", + args = { String.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getXMLVersion", + args = { } + ) + }) + public void testSetXMLVersionGetXMLVersion() { + Locator2Impl l = new Locator2Impl(); + + l.setXMLVersion(XML); + assertEquals(XML, l.getXMLVersion()); + + l.setXMLVersion(null); + assertEquals(null, l.getXMLVersion()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setEncoding", + args = { String.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getEncoding", + args = { } + ) + }) + public void testSetEncodingGetEncoding() { + Locator2Impl l = new Locator2Impl(); + + l.setEncoding(ENC); + assertEquals(ENC, l.getEncoding()); + + l.setEncoding(null); + assertEquals(null, l.getEncoding()); + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/AllTests.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/AllTests.java new file mode 100644 index 0000000..5bf63bf --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/helpers/AllTests.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.helpers; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTests { + + public static void main(String[] args) { + junit.textui.TestRunner.run(AllTests.suite()); + } + + public static Test suite() { + TestSuite suite = tests.TestSuiteFactory.createTestSuite("Tests for org.xml.sax.helpers package"); + // $JUnit-BEGIN$ + + suite.addTestSuite(AttributeListImplTest.class); + suite.addTestSuite(AttributesImplTest.class); + suite.addTestSuite(ParserFactoryTest.class); + suite.addTestSuite(DefaultHandlerTest.class); + suite.addTestSuite(LocatorImplTest.class); + suite.addTestSuite(NamespaceSupportTest.class); + suite.addTestSuite(XMLFilterImplTest.class); + suite.addTestSuite(XMLReaderAdapterTest.class); + suite.addTestSuite(XMLReaderFactoryTest.class); + + // $JUnit-END$ + return suite; + } +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/AttributeListImplTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/AttributeListImplTest.java new file mode 100644 index 0000000..00658cb --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/helpers/AttributeListImplTest.java @@ -0,0 +1,270 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.helpers; + +import junit.framework.TestCase; + +import org.xml.sax.AttributeList; +import org.xml.sax.helpers.AttributeListImpl; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; + +@SuppressWarnings("deprecation") +@TestTargetClass(AttributeListImpl.class) +public class AttributeListImplTest extends TestCase { + + private AttributeListImpl empty = new AttributeListImpl(); + + private AttributeListImpl multi = new AttributeListImpl(); + + @Override + public void setUp() { + multi.addAttribute("foo", "string", "abc"); + multi.addAttribute("bar", "string", "xyz"); + multi.addAttribute("answer", "int", "42"); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "AttributeListImpl", + args = { } + ) + public void testAttributeListImpl() { + assertEquals(0, empty.getLength()); + assertEquals(3, multi.getLength()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "AttributeListImpl", + args = { AttributeList.class } + ) + public void testAttributeListImplAttributeList() { + // Ordinary case + AttributeListImpl ai = new AttributeListImpl(empty); + assertEquals(0, ai.getLength()); + + // Another ordinary case + ai = new AttributeListImpl(multi); + assertEquals(3, ai.getLength()); + + // No Attributes + try { + ai = new AttributeListImpl(null); + assertEquals(0, ai.getLength()); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setAttributeList", + args = { AttributeList.class } + ) + public void testSetAttributeList() { + // Ordinary cases + AttributeListImpl attrs = new AttributeListImpl(); + attrs.addAttribute("doe", "boolean", "false"); + + attrs.setAttributeList(empty); + assertEquals(0, attrs.getLength()); + + attrs.setAttributeList(multi); + assertEquals(multi.getLength(), attrs.getLength()); + + for (int i = 0; i < multi.getLength(); i++) { + assertEquals(multi.getName(i), attrs.getName(i)); + assertEquals(multi.getType(i), attrs.getType(i)); + assertEquals(multi.getValue(i), attrs.getValue(i)); + } + + // null case + try { + attrs.setAttributeList(null); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected, must still have old elements + assertEquals(3, attrs.getLength()); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "addAttribute", + args = { String.class, String.class, String.class } + ) + public void testAddAttribute() { + // Ordinary case + multi.addAttribute("doe", "boolean", "false"); + + assertEquals("doe", multi.getName(3)); + assertEquals("boolean", multi.getType(3)); + assertEquals("false", multi.getValue(3)); + + // Duplicate case + multi.addAttribute("doe", "boolean", "false"); + + assertEquals("doe", multi.getName(4)); + assertEquals("boolean", multi.getType(4)); + assertEquals("false", multi.getValue(4)); + + // null case + multi.addAttribute(null, null, null); + assertEquals(null, multi.getName(5)); + assertEquals(null, multi.getType(5)); + assertEquals(null, multi.getValue(5)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "removeAttribute", + args = { String.class } + ) + public void testRemoveAttribute() { + // Ordinary case + multi.removeAttribute("foo"); + assertEquals("bar", multi.getName(0)); + assertEquals("string", multi.getType(0)); + assertEquals("xyz", multi.getValue(0)); + + // Unknown attribute + multi.removeAttribute("john"); + assertEquals(2, multi.getLength()); + + // null case + multi.removeAttribute(null); + assertEquals(2, multi.getLength()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "clear", + args = { } + ) + public void testClear() { + assertEquals(3, multi.getLength()); + multi.clear(); + assertEquals(0, multi.getLength()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getLength", + args = { } + ) + public void testGetLength() { + AttributeListImpl ai = new AttributeListImpl(empty); + assertEquals(0, ai.getLength()); + + ai = new AttributeListImpl(multi); + assertEquals(3, ai.getLength()); + + for (int i = 2; i >= 0; i--) { + ai.removeAttribute(ai.getName(i)); + assertEquals(i, ai.getLength()); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getName", + args = { int.class } + ) + public void testGetName() { + // Ordinary cases + assertEquals("foo", multi.getName(0)); + assertEquals("bar", multi.getName(1)); + assertEquals("answer", multi.getName(2)); + + // Out of range + assertEquals(null, multi.getName(-1)); + assertEquals(null, multi.getName(3)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getType", + args = { int.class } + ) + public void testGetTypeInt() { + // Ordinary cases + assertEquals("string", multi.getType(0)); + assertEquals("string", multi.getType(1)); + assertEquals("int", multi.getType(2)); + + // Out of range + assertEquals(null, multi.getType(-1)); + assertEquals(null, multi.getType(3)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getValue", + args = { int.class } + ) + public void testGetValueInt() { + // Ordinary cases + assertEquals("abc", multi.getValue(0)); + assertEquals("xyz", multi.getValue(1)); + assertEquals("42", multi.getValue(2)); + + // Out of range + assertEquals(null, multi.getValue(-1)); + assertEquals(null, multi.getValue(5)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getType", + args = { String.class } + ) + public void testGetTypeString() { + // Ordinary cases + assertEquals("string", multi.getType("foo")); + assertEquals("string", multi.getType("bar")); + assertEquals("int", multi.getType("answer")); + + // Not found + assertEquals(null, multi.getType("john")); + + // null case + assertEquals(null, multi.getType(null)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getValue", + args = { String.class } + ) + public void testGetValueString() { + // Ordinary cases + assertEquals("abc", multi.getValue("foo")); + assertEquals("xyz", multi.getValue("bar")); + assertEquals("42", multi.getValue("answer")); + + // Not found + assertEquals(null, multi.getValue("john")); + + // null case + assertEquals(null, multi.getValue(null)); + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/AttributesImplTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/AttributesImplTest.java new file mode 100644 index 0000000..0efe25f --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/helpers/AttributesImplTest.java @@ -0,0 +1,608 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.helpers; + +import junit.framework.TestCase; + +import org.xml.sax.Attributes; +import org.xml.sax.helpers.AttributesImpl; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; + +@TestTargetClass(AttributesImpl.class) +public class AttributesImplTest extends TestCase { + + private AttributesImpl empty = new AttributesImpl(); + + private AttributesImpl multi = new AttributesImpl(); + + @Override + public void setUp() { + multi.addAttribute("http://some.uri", "foo", "ns1:foo", + "string", "abc"); + multi.addAttribute("http://some.uri", "bar", "ns1:bar", + "string", "xyz"); + multi.addAttribute("http://some.other.uri", "answer", "ns2:answer", + "int", "42"); + + multi.addAttribute("", "gabbaHey", "", "string", "1-2-3-4"); + multi.addAttribute("", "", "gabba:hey", "string", "1-2-3-4"); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "AttributesImpl", + args = { } + ) + public void testAttributesImpl() { + assertEquals(0, empty.getLength()); + assertEquals(5, multi.getLength()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "AttributesImpl", + args = { Attributes.class } + ) + public void testAttributesImplAttributes() { + // Ordinary case + AttributesImpl ai = new AttributesImpl(empty); + assertEquals(0, ai.getLength()); + + // Another ordinary case + ai = new AttributesImpl(multi); + assertEquals(5, ai.getLength()); + + // No Attributes + try { + ai = new AttributesImpl(null); + assertEquals(0, ai.getLength()); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getLength", + args = { } + ) + public void testGetLength() { + AttributesImpl ai = new AttributesImpl(empty); + assertEquals(0, ai.getLength()); + + ai = new AttributesImpl(multi); + assertEquals(5, ai.getLength()); + + for (int i = 4; i >= 0; i--) { + ai.removeAttribute(i); + assertEquals(i, ai.getLength()); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getURI", + args = { int.class } + ) + public void testGetURI() { + // Ordinary cases + assertEquals("http://some.uri", multi.getURI(0)); + assertEquals("http://some.uri", multi.getURI(1)); + assertEquals("http://some.other.uri", multi.getURI(2)); + assertEquals("", multi.getURI(3)); + assertEquals("", multi.getURI(4)); + + // Out of range + assertEquals(null, multi.getURI(-1)); + assertEquals(null, multi.getURI(5)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getLocalName", + args = { int.class } + ) + public void testGetLocalName() { + // Ordinary cases + assertEquals("foo", multi.getLocalName(0)); + assertEquals("bar", multi.getLocalName(1)); + assertEquals("answer", multi.getLocalName(2)); + assertEquals("gabbaHey", multi.getLocalName(3)); + assertEquals("", multi.getLocalName(4)); + + // Out of range + assertEquals(null, multi.getLocalName(-1)); + assertEquals(null, multi.getLocalName(5)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getQName", + args = { int.class } + ) + public void testGetQName() { + // Ordinary cases + assertEquals("ns1:foo", multi.getQName(0)); + assertEquals("ns1:bar", multi.getQName(1)); + assertEquals("ns2:answer", multi.getQName(2)); + assertEquals("", multi.getQName(3)); + assertEquals("gabba:hey", multi.getQName(4)); + + // Out of range + assertEquals(null, multi.getQName(-1)); + assertEquals(null, multi.getQName(5)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getType", + args = { int.class } + ) + public void testGetTypeInt() { + // Ordinary cases + assertEquals("string", multi.getType(0)); + assertEquals("string", multi.getType(1)); + assertEquals("int", multi.getType(2)); + assertEquals("string", multi.getType(3)); + assertEquals("string", multi.getType(4)); + + // Out of range + assertEquals(null, multi.getType(-1)); + assertEquals(null, multi.getType(5)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getValue", + args = { int.class } + ) + public void testGetValueInt() { + // Ordinary cases + assertEquals("abc", multi.getValue(0)); + assertEquals("xyz", multi.getValue(1)); + assertEquals("42", multi.getValue(2)); + assertEquals("1-2-3-4", multi.getValue(3)); + assertEquals("1-2-3-4", multi.getValue(4)); + + // Out of range + assertEquals(null, multi.getValue(-1)); + assertEquals(null, multi.getValue(5)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getIndex", + args = { String.class, String.class } + ) + public void testGetIndexStringString() { + // Ordinary cases + assertEquals(0, multi.getIndex("http://some.uri", "foo")); + assertEquals(1, multi.getIndex("http://some.uri", "bar")); + assertEquals(2, multi.getIndex("http://some.other.uri", "answer")); + + // Not found + assertEquals(-1, multi.getIndex("john", "doe")); + + // null cases + assertEquals(-1, multi.getIndex("http://some.uri", null)); + assertEquals(-1, multi.getIndex(null, "foo")); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getIndex", + args = { String.class } + ) + public void testGetIndexString() { + // Ordinary cases + assertEquals(0, multi.getIndex("ns1:foo")); + assertEquals(1, multi.getIndex("ns1:bar")); + assertEquals(2, multi.getIndex("ns2:answer")); + assertEquals(4, multi.getIndex("gabba:hey")); + + // Not found + assertEquals(-1, multi.getIndex("john:doe")); + + // null case + assertEquals(-1, multi.getIndex(null)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getType", + args = { String.class, String.class } + ) + public void testGetTypeStringString() { + // Ordinary cases + assertEquals("string", multi.getType("http://some.uri", "foo")); + assertEquals("string", multi.getType("http://some.uri", "bar")); + assertEquals("int", multi.getType("http://some.other.uri", "answer")); + + // Not found + assertEquals(null, multi.getType("john", "doe")); + + // null cases + assertEquals(null, multi.getType("http://some.uri", null)); + assertEquals(null, multi.getType(null, "foo")); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getType", + args = { String.class } + ) + public void testGetTypeString() { + // Ordinary cases + assertEquals("string", multi.getType("ns1:foo")); + assertEquals("string", multi.getType("ns1:bar")); + assertEquals("int", multi.getType("ns2:answer")); + assertEquals("string", multi.getType("gabba:hey")); + + // Not found + assertEquals(null, multi.getType("john:doe")); + + // null case + assertEquals(null, multi.getType(null)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getValue", + args = { String.class, String.class } + ) + public void testGetValueStringString() { + // Ordinary cases + assertEquals("abc", multi.getValue("http://some.uri", "foo")); + assertEquals("xyz", multi.getValue("http://some.uri", "bar")); + assertEquals("42", multi.getValue("http://some.other.uri", "answer")); + + // Not found + assertEquals(null, multi.getValue("john", "doe")); + + // null cases + assertEquals(null, multi.getValue("http://some.uri", null)); + assertEquals(null, multi.getValue(null, "foo")); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getValue", + args = { String.class } + ) + public void testGetValueString() { + // Ordinary cases + assertEquals("abc", multi.getValue("ns1:foo")); + assertEquals("xyz", multi.getValue("ns1:bar")); + assertEquals("42", multi.getValue("ns2:answer")); + assertEquals("1-2-3-4", multi.getValue("gabba:hey")); + + // Not found + assertEquals(null, multi.getValue("john:doe")); + + // null case + assertEquals(null, multi.getValue(null)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "clear", + args = { } + ) + public void testClear() { + assertEquals(5, multi.getLength()); + multi.clear(); + assertEquals(0, multi.getLength()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setAttributes", + args = { Attributes.class } + ) + public void testSetAttributes() { + // Ordinary cases + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("http://yet.another.uri", "doe", "john:doe", + "boolean", "false"); + + attrs.setAttributes(empty); + assertEquals(0, attrs.getLength()); + + attrs.setAttributes(multi); + assertEquals(multi.getLength(), attrs.getLength()); + + for (int i = 0; i < multi.getLength(); i++) { + assertEquals(multi.getURI(i), attrs.getURI(i)); + assertEquals(multi.getLocalName(i), attrs.getLocalName(i)); + assertEquals(multi.getQName(i), attrs.getQName(i)); + assertEquals(multi.getType(i), attrs.getType(i)); + assertEquals(multi.getValue(i), attrs.getValue(i)); + } + + // null case + try { + attrs.setAttributes(null); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected, but must be empty now + assertEquals(0, attrs.getLength()); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "addAttribute", + args = { String.class, String.class, String.class, String.class, + String.class } + ) + public void testAddAttribute() { + // Ordinary case + multi.addAttribute("http://yet.another.uri", "doe", "john:doe", + "boolean", "false"); + + assertEquals("http://yet.another.uri", multi.getURI(5)); + assertEquals("doe", multi.getLocalName(5)); + assertEquals("john:doe", multi.getQName(5)); + assertEquals("boolean", multi.getType(5)); + assertEquals("false", multi.getValue(5)); + + // Duplicate case + multi.addAttribute("http://yet.another.uri", "doe", "john:doe", + "boolean", "false"); + + assertEquals("http://yet.another.uri", multi.getURI(6)); + assertEquals("doe", multi.getLocalName(6)); + assertEquals("john:doe", multi.getQName(6)); + assertEquals("boolean", multi.getType(6)); + assertEquals("false", multi.getValue(6)); + + // null case + multi.addAttribute(null, null, null, null, null); + assertEquals(null, multi.getURI(7)); + assertEquals(null, multi.getLocalName(7)); + assertEquals(null, multi.getQName(7)); + assertEquals(null, multi.getType(7)); + assertEquals(null, multi.getValue(7)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setAttribute", + args = { int.class, String.class, String.class, String.class, + String.class, String.class } + ) + public void testSetAttribute() { + // Ordinary case + multi.setAttribute(0, "http://yet.another.uri", "doe", "john:doe", + "boolean", "false"); + assertEquals("http://yet.another.uri", multi.getURI(0)); + assertEquals("doe", multi.getLocalName(0)); + assertEquals("john:doe", multi.getQName(0)); + assertEquals("boolean", multi.getType(0)); + assertEquals("false", multi.getValue(0)); + + // null case + multi.setAttribute(1, null, null, null, null, null); + assertEquals(null, multi.getURI(1)); + assertEquals(null, multi.getLocalName(1)); + assertEquals(null, multi.getQName(1)); + assertEquals(null, multi.getType(1)); + assertEquals(null, multi.getValue(1)); + + // Out of range + try { + multi.setAttribute(-1, "http://yet.another.uri", "doe", "john:doe", + "boolean", "false"); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + + try { + multi.setAttribute(5, "http://yet.another.uri", "doe", "john:doe", + "boolean", "false"); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "removeAttribute", + args = { int.class } + ) + public void testRemoveAttribute() { + // Ordinary case + multi.removeAttribute(0); + assertEquals("http://some.uri", multi.getURI(0)); + assertEquals("bar", multi.getLocalName(0)); + assertEquals("ns1:bar", multi.getQName(0)); + assertEquals("string", multi.getType(0)); + assertEquals("xyz", multi.getValue(0)); + + // Out of range + try { + multi.removeAttribute(-1); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + + try { + multi.removeAttribute(4); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setURI", + args = { int.class, String.class } + ) + public void testSetURI() { + // Ordinary case + multi.setURI(0, "http://yet.another.uri"); + assertEquals("http://yet.another.uri", multi.getURI(0)); + + // null case + multi.setURI(1, null); + assertEquals(null, multi.getURI(1)); + + // Out of range + try { + multi.setURI(-1, "http://yet.another.uri"); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + + try { + multi.setURI(5, "http://yet.another.uri"); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setLocalName", + args = { int.class, String.class } + ) + public void testSetLocalName() { + // Ordinary case + multi.setLocalName(0, "john"); + assertEquals("john", multi.getLocalName(0)); + + // null case + multi.setLocalName(1, null); + assertEquals(null, multi.getLocalName(1)); + + // Out of range + try { + multi.setLocalName(-1, "john"); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + + try { + multi.setLocalName(5, "john"); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setQName", + args = { int.class, String.class } + ) + public void testSetQName() { + // Ordinary case + multi.setQName(0, "john:doe"); + assertEquals("john:doe", multi.getQName(0)); + + // null case + multi.setQName(1, null); + assertEquals(null, multi.getQName(1)); + + // Out of range + try { + multi.setQName(-1, "john:doe"); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + + try { + multi.setQName(5, "john:doe"); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setType", + args = { int.class, String.class } + ) + public void testSetType() { + // Ordinary case + multi.setType(0, "float"); + assertEquals("float", multi.getType(0)); + + // null case + multi.setType(1, null); + assertEquals(null, multi.getType(1)); + + // Out of range + try { + multi.setType(-1, "float"); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + + try { + multi.setType(5, "float"); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setValue", + args = { int.class, String.class } + ) + public void testSetValue() { + // Ordinary case + multi.setValue(0, "too much"); + assertEquals("too much", multi.getValue(0)); + + // null case + multi.setValue(1, null); + assertEquals(null, multi.getValue(1)); + + // Out of range + try { + multi.setValue(-1, "too much"); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + + try { + multi.setValue(5, "too much"); + fail("ArrayIndexOutOfBoundsException expected"); + } catch (ArrayIndexOutOfBoundsException e) { + // Expected + } + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/DefaultHandlerTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/DefaultHandlerTest.java new file mode 100644 index 0000000..527048f --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/helpers/DefaultHandlerTest.java @@ -0,0 +1,278 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.helpers; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; + +import junit.framework.TestCase; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.helpers.AttributesImpl; +import org.xml.sax.helpers.DefaultHandler; +import org.xml.sax.helpers.LocatorImpl; + +import java.io.IOException; + +@TestTargetClass(DefaultHandler.class) +public class DefaultHandlerTest extends TestCase { + + /* + * Note: most of the tests have to check for an empty implementation of the + * respective methods and, as a result, are somewhat trivial. + */ + + private DefaultHandler h = new DefaultHandler(); + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "resolveEntity", + args = { String.class, String.class } + ) + public void testResolveEntity() { + try { + h.resolveEntity("publicID", "systemID"); + } catch (SAXException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "notationDecl", + args = { String.class, String.class, String.class } + ) + public void testNotationDecl() { + try { + h.notationDecl("name", "publicID", "systemID"); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "unparsedEntityDecl", + args = { String.class, String.class, String.class, String.class } + ) + public void testUnparsedEntityDecl() { + try { + h.unparsedEntityDecl("name", "publicID", "systemID", + "notationName"); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setDocumentLocator", + args = { org.xml.sax.Locator.class } + ) + public void testSetDocumentLocator() { + h.setDocumentLocator(new LocatorImpl()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startDocument", + args = { } + ) + public void testStartDocument() { + try { + h.startDocument(); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endDocument", + args = { } + ) + public void testEndDocument() { + try { + h.endDocument(); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startPrefixMapping", + args = { String.class, String.class } + ) + public void testStartPrefixMapping() { + try { + h.startPrefixMapping("prefix", "uri"); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endPrefixMapping", + args = { String.class } + ) + public void testEndPrefixMapping() { + try { + h.endPrefixMapping("prefix"); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startElement", + args = { String.class, String.class, String.class, + Attributes.class } + ) + public void testStartElement() { + try { + h.startElement("uri", "name", "qname", new AttributesImpl()); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endElement", + args = { String.class, String.class, String.class } + ) + public void testEndElement() { + try { + h.endElement("uri", "name", "qname"); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "characters", + args = { char[].class, int.class, int.class } + ) + public void testCharacters() { + try { + h.characters("The quick brown fox".toCharArray(), 4, 11); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "ignorableWhitespace", + args = { char[].class, int.class, int.class } + ) + public void testIgnorableWhitespace() { + try { + h.ignorableWhitespace(" ".toCharArray(), 4, 11); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "processingInstruction", + args = { String.class, String.class } + ) + public void testProcessingInstruction() { + try { + h.processingInstruction("target", "data"); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "skippedEntity", + args = { String.class } + ) + public void testSkippedEntity() { + try { + h.skippedEntity("name"); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "warning", + args = { org.xml.sax.SAXParseException.class } + ) + public void testWarning() { + try { + h.warning(new SAXParseException("Foo", new LocatorImpl())); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "error", + args = { org.xml.sax.SAXParseException.class } + ) + public void testError() { + try { + h.error(new SAXParseException("Foo", new LocatorImpl())); + } catch (SAXException e) { + throw new RuntimeException(e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "fatalError", + args = { org.xml.sax.SAXParseException.class } + ) + public void testFatalError() { + // Ordinary case + try { + h.fatalError(new SAXParseException("Foo", new LocatorImpl())); + fail("SAXException expected"); + } catch (SAXException e) { + // Expected + } + + // No exception + try { + h.fatalError(null); + fail("NullPointerException expected"); + } catch (SAXException e) { + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected + } + + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/LocatorImplTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/LocatorImplTest.java new file mode 100644 index 0000000..e6b243c --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/helpers/LocatorImplTest.java @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.helpers; + +import junit.framework.TestCase; + +import org.xml.sax.Locator; +import org.xml.sax.helpers.LocatorImpl; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; +import dalvik.annotation.TestTargets; + +@TestTargetClass(LocatorImpl.class) +public class LocatorImplTest extends TestCase { + + public static final String SYS = "mySystemID"; + + public static final String PUB = "myPublicID"; + + public static final int ROW = 1; + + public static final int COL = 2; + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "LocatorImpl", + args = { } + ) + public void testLocatorImpl() { + LocatorImpl l = new LocatorImpl(); + + assertEquals(null, l.getPublicId()); + assertEquals(null, l.getSystemId()); + assertEquals(0, l.getLineNumber()); + assertEquals(0, l.getColumnNumber()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "LocatorImpl", + args = { Locator.class } + ) + public void testLocatorImplLocator() { + LocatorImpl inner = new LocatorImpl(); + + inner.setPublicId(PUB); + inner.setSystemId(SYS); + inner.setLineNumber(ROW); + inner.setColumnNumber(COL); + + // Ordinary case + LocatorImpl outer = new LocatorImpl(inner); + + assertEquals(PUB, outer.getPublicId()); + assertEquals(SYS, outer.getSystemId()); + assertEquals(ROW, outer.getLineNumber()); + assertEquals(COL, outer.getColumnNumber()); + + // No locator + try { + outer = new LocatorImpl(null); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected + } + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setPublicId", + args = { String.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getPublicId", + args = { } + ) + }) + public void testSetPublicIdGetPublicId() { + LocatorImpl l = new LocatorImpl(); + + l.setPublicId(PUB); + assertEquals(PUB, l.getPublicId()); + + l.setPublicId(null); + assertEquals(null, l.getPublicId()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setSystemId", + args = { String.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getSystemId", + args = { } + ) + }) + public void testSetSystemIdGetSystemId() { + LocatorImpl l = new LocatorImpl(); + + l.setSystemId(SYS); + assertEquals(SYS, l.getSystemId()); + + l.setSystemId(null); + assertEquals(null, l.getSystemId()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setLineNumber", + args = { int.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getLineNumber", + args = { } + ) + }) + public void testSetLineNumberGetLineNumber() { + LocatorImpl l = new LocatorImpl(); + + l.setLineNumber(ROW); + assertEquals(ROW, l.getLineNumber()); + + l.setLineNumber(0); + assertEquals(0, l.getLineNumber()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setColumnNumber", + args = { int.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getColumnNumber", + args = { } + ) + }) + public void testSetColumnNumberGetColumnNumber() { + LocatorImpl l = new LocatorImpl(); + + l.setColumnNumber(COL); + assertEquals(COL, l.getColumnNumber()); + + l.setColumnNumber(0); + assertEquals(0, l.getColumnNumber()); + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/NamespaceSupportTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/NamespaceSupportTest.java new file mode 100644 index 0000000..b163b54 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/helpers/NamespaceSupportTest.java @@ -0,0 +1,434 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.helpers; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EmptyStackException; +import java.util.Enumeration; + +import junit.framework.TestCase; + +import org.xml.sax.helpers.NamespaceSupport; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; +import dalvik.annotation.TestTargets; + +@TestTargetClass( + value = NamespaceSupport.class, + untestedMethods = { + } +) +public class NamespaceSupportTest extends TestCase { + + final static String defaultUri = "http://www.android.com"; + final static String marketUri = "http://www.android.com/market"; + + NamespaceSupport ns; + ArrayList<String> expected; + + @Override + public void setUp() { + expected = new ArrayList<String>(); + expected.add("ak"); + expected.add("bk"); + + ns = new NamespaceSupport(); + ns.pushContext(); + + ns.declarePrefix("ak", marketUri); + ns.declarePrefix("bk", marketUri); + ns.declarePrefix("", defaultUri); + } + + @SuppressWarnings("unchecked") + @TestTargets ({ + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "Checks that a new NamespaceSupport object contains a " + + "default context with two predefined prefixes.", + method = "NamespaceSupport", + args = {} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "popContext", + args = {} + ) + }) + public void testConstructor() { + String prefix; + boolean xmlPrefixExists = false; + + ns = new NamespaceSupport(); + Enumeration<String> prefixes = ns.getDeclaredPrefixes(); + + while (prefixes.hasMoreElements()) { + prefix = prefixes.nextElement(); + if (prefix.equals("xml")) xmlPrefixExists = true; + } + + assertTrue("Test 1: xml prefix does not exist.", xmlPrefixExists); + + // Check that only one context has been created by the constructor. + try { + ns.popContext(); + fail("Test 2: EmptyStackException expected."); + } catch (EmptyStackException e) { + // Expected. + } + } + + @TestTargets ({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "pushContext", + args = {} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "popContext", + args = {} + ) + }) + public void testPush_PopContext() { + int count; + + ns = new NamespaceSupport(); + count = countPrefixes(); + + ns.pushContext(); + ns.declarePrefix("dc", "http://www.purl.org/dc#"); + assertEquals("Test 1: Incorrect prefix count;", + count + 1, countPrefixes()); + + ns.popContext(); + assertEquals("Test 2: Incorrect prefix count;", + count, countPrefixes()); + + // Check that only one context has been created by pushContext(). + try { + ns.popContext(); + fail("Test 3: EmptyStackException expected."); + } catch (EmptyStackException e) { + // Expected. + } + } + + @TestTargets ({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "reset", + args = {} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "popContext", + args = {} + ) + }) + public void testReset() { + int count; + + ns = new NamespaceSupport(); + count = countPrefixes(); + + ns.pushContext(); + ns.declarePrefix("dc", "http://www.purl.org/dc#"); + + assertEquals("Test 1: Incorrect prefix count;", + count + 1, countPrefixes()); + + ns.reset(); + assertEquals("Test 2: Incorrect prefix count;", + count, countPrefixes()); + + // Check that only one context has been created by reset(). + try { + ns.popContext(); + fail("Test 3: EmptyStackException expected."); + } catch (EmptyStackException e) { + // Expected. + } + } + + @TestTargets ({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "declarePrefix", + args = {String.class, String.class} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getPrefix", + args = {String.class} + ) + }) + public void testDeclare_GetPrefix() { + ns.pushContext(); + + // Part 1: Check that xml and xmlns are not accepted as prefixes. + assertFalse("Test 1: Invalid prefix accepted.", + ns.declarePrefix("xml", marketUri)); + + assertFalse("Test 2: Invalid prefix accepted.", + ns.declarePrefix("xmlns", marketUri)); + + // Part 2: Check that declarePrefix and getPrefix work for valid + // prefixes. + assertTrue("Test 3: Valid prefix not accepted.", + ns.declarePrefix("ak", marketUri)); + + assertTrue("Test 4: Incorrect prefix returned.", + ns.getPrefix(marketUri).equals("ak")); + + assertTrue("Test 5: Valid prefix not accepted.", + ns.declarePrefix("bk", marketUri)); + + assertTrue("Test 6: Incorrect prefix returned.", + expected.contains(ns.getPrefix(marketUri))); + + assertTrue("Test 7: Valid prefix not accepted.", + ns.declarePrefix("", defaultUri)); + + // Part 3: Negative Tests for getPrefix. + assertNull("Test 8: Non-null value returned for the URI that is " + + "assigned to the default namespace.", + ns.getPrefix(defaultUri)); + + assertNull("Test 9: Non-null value returned for an unassigned URI.", + ns.getPrefix(defaultUri + "/42")); + } + + @SuppressWarnings("unchecked") + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getPrefixes", + args = {String.class} + ) + public void testGetPrefixesLjava_lang_String() { + ArrayList<String> prefixes; + + prefixes = Collections.list(ns.getPrefixes(marketUri)); + assertTrue("Test 1: Incorrect set of prefixes returned.", + expected.containsAll(prefixes) && prefixes.containsAll(expected)); + + prefixes = Collections.list(ns.getPrefixes(defaultUri)); + assertTrue("Test 2: Default namespace prefix should not be returned.", + prefixes.size() == 0); + + prefixes = Collections.list(ns.getPrefixes(NamespaceSupport.XMLNS)); + assertTrue("Test 3: xml prefix is missing.", + prefixes.contains("xml") && prefixes.size() == 1); + + prefixes = Collections.list(ns.getPrefixes(defaultUri + "/42")); + assertTrue("Test 4: Non-empty enumeration returned for an unassigned URI.", + prefixes.size() == 0); + } + + @SuppressWarnings("unchecked") + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getPrefixes", + args = {} + ) + public void testGetPrefixes() { + ArrayList<String> prefixes; + + expected.add("xml"); + + prefixes = Collections.list(ns.getPrefixes()); + assertTrue("Test 1: Incorrect set of prefixes returned.", + expected.containsAll(prefixes) && prefixes.containsAll(expected)); + } + + @SuppressWarnings("unchecked") + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getDeclaredPrefixes", + args = {} + ) + public void testGetDeclaredPrefixes() { + ArrayList<String> prefixes; + + expected.add(""); + + prefixes = Collections.list(ns.getDeclaredPrefixes()); + assertTrue("Test 1: Incorrect set of prefixes returned.", + expected.containsAll(prefixes) && prefixes.containsAll(expected)); + } + + @TestTargets ({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getURI", + args = {String.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "popContext", + args = {} + ) + }) + public void testGetUri() { + assertEquals("Test 1: Incorrect URI returned;", + marketUri, ns.getURI("bk")); + assertEquals("Test 2: Incorrect URI returned;", + defaultUri, ns.getURI("")); + assertNull("Test 3: Null expected for not-existing prefix.", + ns.getURI("ck")); + + ns.popContext(); + assertNull("Test 4: Null expected for not-existing prefix.", + ns.getURI("bk")); + assertEquals("Test 5: Incorrect URI returned;", + NamespaceSupport.XMLNS, ns.getURI("xml")); + } + + @TestTargets ({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "setNamespaceDeclUris", + args = {boolean.class} + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "isNamespaceDeclUris", + args = {} + ) + }) + public void testNamespaceDeclUris() { + + assertFalse("Test 1: Incorrect default value returned by isNamespaceDeclUris().", + ns.isNamespaceDeclUris()); + + try { + ns.setNamespaceDeclUris(true); + fail("Test 2: IllegalStateException expected since a context has already been pushed in setUp()."); + } catch (IllegalStateException e) { + // Expected. + } + + ns = new NamespaceSupport(); + ns.setNamespaceDeclUris(true); + assertTrue("Test 3: Incorrect value returned by isNamespaceDeclUris().", + ns.isNamespaceDeclUris()); + + ns.setNamespaceDeclUris(false); + assertFalse("Test 4: Incorrect value returned by isNamespaceDeclUris().", + ns.isNamespaceDeclUris()); + } + + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "processName", + args = {String.class, String[].class, boolean.class} + ) + public void testProcessName_Element() { + String[] parts = new String[3]; + + assertNotNull("Test 1: Non-null value expected.", + ns.processName("ak:hello", parts, false)); + assertEquals("Test 2: Incorrect namespace URI;", marketUri, parts[0]); + assertEquals("Test 3: Incorrect local name;", "hello", parts[1]); + assertEquals("Test 4: Incorrect raw name;", "ak:hello", parts[2]); + + assertNotNull("Test 5: Non-null value expected.", + ns.processName("bk:", parts, false)); + assertEquals("Test 6: Incorrect namespace URI;", marketUri, parts[0]); + assertEquals("Test 7: Incorrect local name;", "", parts[1]); + assertEquals("Test 8: Incorrect raw name;", "bk:", parts[2]); + + assertNotNull("Test 9: Non-null value expected.", + ns.processName("world", parts, false)); + assertEquals("Test 10: Incorrect namespace URI;", defaultUri, parts[0]); + assertEquals("Test 11: Incorrect local name;", "world", parts[1]); + assertEquals("Test 12: Incorrect raw name;", "world", parts[2]); + + assertNull("Test 13: Null expected for undeclared prefix.", + ns.processName("ck:lorem", parts, false)); + + assertNull("Test 14: Null expected for xmlns prefix.", + ns.processName("xmlns:ipsum", parts, false)); + + ns = new NamespaceSupport(); + ns.pushContext(); + assertNotNull("Test 15: Non-null value expected.", + ns.processName("world", parts, false)); + assertEquals("Test 16: Incorrect namespace URI;", "", parts[0]); + assertEquals("Test 17: Incorrect local name;", "world", parts[1]); + assertEquals("Test 18: Incorrect raw name;", "world", parts[2]); + } + + @TestTargets ({ + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "setNamespaceDeclUris", + args = {boolean.class} + ), + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + method = "processName", + args = {String.class, String[].class, boolean.class} + ) + }) + public void testProcessName_Attribute() { + String[] parts = new String[3]; + + assertNotNull("Test 1: Non-null value expected.", + ns.processName("ak:hello", parts, true)); + assertEquals("Test 2: Incorrect namespace URI;", marketUri, parts[0]); + assertEquals("Test 3: Incorrect local name;", "hello", parts[1]); + assertEquals("Test 4: Incorrect raw name;", "ak:hello", parts[2]); + + assertNotNull("Test 5: Non-null value expected.", + ns.processName("bk:", parts, true)); + assertEquals("Test 6: Incorrect namespace URI;", marketUri, parts[0]); + assertEquals("Test 7: Incorrect local name;", "", parts[1]); + assertEquals("Test 8: Incorrect raw name;", "bk:", parts[2]); + + assertNotNull("Test 9: Non-null value expected.", + ns.processName("world", parts, true)); + assertEquals("Test 10: Incorrect namespace URI;", "", parts[0]); + assertEquals("Test 11: Incorrect local name;", "world", parts[1]); + assertEquals("Test 12: Incorrect raw name;", "world", parts[2]); + + assertNull("Test 13: Null expected for undeclared prefix.", + ns.processName("ck:lorem", parts, true)); + + assertNull("Test 14: Null expected for xmlns prefix.", + ns.processName("xmlns:ipsum", parts, true)); + + ns = new NamespaceSupport(); + ns.setNamespaceDeclUris(true); + ns.pushContext(); + assertNotNull("Test 15: Non-null value expected.", + ns.processName("xmlns", parts, true)); + assertEquals("Test 16: Incorrect namespace URI;", NamespaceSupport.NSDECL, parts[0]); + assertEquals("Test 17: Incorrect local name;", "xmlns", parts[1]); + assertEquals("Test 18: Incorrect raw name;", "xmlns", parts[2]); + } + + @SuppressWarnings("unchecked") + private int countPrefixes() + { + ArrayList<String> prefixes = Collections.list(ns.getPrefixes()); + return prefixes.size(); + } +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/ParserAdapterTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/ParserAdapterTest.java new file mode 100644 index 0000000..27a7e78 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/helpers/ParserAdapterTest.java @@ -0,0 +1,468 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.helpers; + +import java.io.IOException; + +import junit.framework.TestCase; + +import org.xml.sax.AttributeList; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.Parser; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.helpers.AttributeListImpl; +import org.xml.sax.helpers.LocatorImpl; +import org.xml.sax.helpers.ParserAdapter; + +import tests.api.org.xml.sax.support.MethodLogger; +import tests.api.org.xml.sax.support.MockHandler; +import tests.api.org.xml.sax.support.MockParser; +import tests.api.org.xml.sax.support.MockResolver; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; +import dalvik.annotation.TestTargets; + +@SuppressWarnings("deprecation") +@TestTargetClass(ParserAdapter.class) +public class ParserAdapterTest extends TestCase { + + // Note: In many cases we can only test that delegation works + // properly. The rest is outside the scope of the specification. + + private final static String FEATURES = "http://xml.org/sax/features/"; + + private final static String NAMESPACES = FEATURES + "namespaces"; + + private final static String NAMESPACE_PREFIXES = FEATURES + + "namespace-prefixes"; + + private final static String XMLNS_URIs = FEATURES + "xmlns-uris"; + + private MethodLogger logger = new MethodLogger(); + + private MockHandler handler = new MockHandler(logger); + + private Parser parser = new MockParser(logger); + + private ParserAdapter adapter = new ParserAdapter(parser); + + private void assertEquals(Object[] a, Object[] b) { + assertEquals(a.length, b.length); + + for (int i = 0; i < a.length; i++) { + assertEquals("Element #" + i + " must be equal", a[i], b[i]); + } + } + + @Override + public void setUp() { + adapter.setContentHandler(handler); + adapter.setDTDHandler(handler); + adapter.setErrorHandler(handler); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "ParserAdapter", + args = { } + ) + public void testParserAdapter() { + System.setProperty("org.xml.sax.parser", + "tests.api.org.xml.sax.support.DoNothingParser"); + + try { + new ParserAdapter(); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "ParserAdapter", + args = { Parser.class } + ) + public void testParserAdapterParser() { + // Ordinary case + @SuppressWarnings("unused") + ParserAdapter adapter = new ParserAdapter(parser); + + // Null case + try { + adapter = new ParserAdapter(null); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected + } + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getFeature", + args = { String.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setFeature", + args = { String.class, boolean.class } + ) + }) + public void testGetSetFeature() { + String[] features = new String[] { NAMESPACES, NAMESPACE_PREFIXES, + XMLNS_URIs }; + + for (String s: features) { + try { + adapter.setFeature(s, true); + assertEquals(true, adapter.getFeature(s)); + + adapter.setFeature(s, false); + assertEquals(false, adapter.getFeature(s)); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + try { + adapter.setFeature("http://argle.bargle", true); + fail("SAXNotRecognizedException expected"); + } catch (SAXNotRecognizedException e) { + // Expected + } catch (SAXNotSupportedException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getProperty", + args = { String.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setProperty", + args = { String.class, Object.class } + ) + }) + public void testGetSetProperty() { + try { + adapter.setProperty("http://argle.bargle", ":)"); + fail("SAXNotRecognizedException expected"); + } catch (SAXNotRecognizedException e) { + // Expected + } catch (SAXNotSupportedException e) { + throw new RuntimeException("Unexpected exception", e); + } + + try { + adapter.getProperty("http://argle.bargle"); + fail("SAXNotRecognizedException expected"); + } catch (SAXNotRecognizedException e) { + // Expected + } catch (SAXNotSupportedException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getEntityResolver", + args = { } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setEntityResolver", + args = { EntityResolver.class } + ) + }) + public void testGetSetEntityResolver() { + EntityResolver resolver = new MockResolver(); + + adapter.setEntityResolver(resolver); + assertEquals(resolver, adapter.getEntityResolver()); + + adapter.setEntityResolver(null); + assertEquals(null, adapter.getEntityResolver()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getDTDHandler", + args = { } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setDTDHandler", + args = { DTDHandler.class } + ) + }) + public void testGetSetDTDHandler() { + adapter.setDTDHandler(null); + assertEquals(null, adapter.getDTDHandler()); + + adapter.setDTDHandler(handler); + assertEquals(handler, adapter.getDTDHandler()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getContentHandler", + args = { } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setContentHandler", + args = { ContentHandler.class } + ) + }) + public void testGetSetContentHandler() { + adapter.setContentHandler(null); + assertEquals(null, adapter.getContentHandler()); + + adapter.setContentHandler(handler); + assertEquals(handler, adapter.getContentHandler()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getErrorHandler", + args = { } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setErrorHandler", + args = { ErrorHandler.class } + ) + }) + public void testGetSetErrorHandler() { + adapter.setErrorHandler(null); + assertEquals(null, adapter.getErrorHandler()); + + adapter.setErrorHandler(handler); + assertEquals(handler, adapter.getErrorHandler()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "parse", + args = { String.class } + ) + public void testParseString() { + try { + adapter.parse("foo"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (IOException e) { + throw new RuntimeException("Unexpected exception", e); + } + + // The SAX RI creates an InputSource itself and then delegates to the + // "other" parse method. + assertEquals("parse", logger.getMethod()); + assertEquals(InputSource.class, logger.getArgs()[0].getClass()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "parse", + args = { InputSource.class } + ) + public void testParseInputSource() { + InputSource source = new InputSource("foo"); + + try { + adapter.parse(source); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (IOException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals("parse", logger.getMethod()); + assertEquals(new Object[] { source }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setDocumentLocator", + args = { Locator.class } + ) + public void testSetDocumentLocator() { + Locator l = new LocatorImpl(); + + adapter.setDocumentLocator(l); + + assertEquals(logger.size(), 1); + assertEquals("setDocumentLocator", logger.getMethod()); + assertEquals(new Object[] { l }, logger.getArgs()); + + adapter.setDocumentLocator(null); + + assertEquals(logger.size(), 2); + assertEquals("setDocumentLocator", logger.getMethod()); + assertEquals(new Object[] { null }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startDocument", + args = { } + ) + public void testStartDocument() { + try { + adapter.startDocument(); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("startDocument", logger.getMethod()); + assertEquals(new Object[] {}, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endDocument", + args = { } + ) + public void testEndDocument() { + try { + adapter.endDocument(); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("endDocument", logger.getMethod()); + assertEquals(new Object[] {}, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startElement", + args = { String.class, AttributeList.class } + ) + public void testStartElement() { + AttributeListImpl atts = new AttributeListImpl(); + atts.addAttribute("john:doe", "int", "42"); + + try { + adapter.startDocument(); + adapter.startElement("foo:bar", atts); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals("startElement", logger.getMethod()); + assertEquals("", logger.getArgs()[0]); + assertEquals("", logger.getArgs()[1]); + assertEquals("foo:bar", logger.getArgs()[2]); + assertEquals("john:doe", ((Attributes)logger.getArgs()[3]).getQName(0)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endElement", + args = { String.class } + ) + public void testEndElement() { + AttributeListImpl atts = new AttributeListImpl(); + atts.addAttribute("john:doe", "int", "42"); + + try { + adapter.startDocument(); + adapter.startElement("foo:bar", atts); + adapter.endElement("foo:bar"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals("endElement", logger.getMethod()); + assertEquals(new String[] { "", "", "foo:bar" }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "characters", + args = { char[].class, int.class, int.class } + ) + public void testCharacters() { + char[] ch = "Android".toCharArray(); + + try { + adapter.characters(ch, 2, 5); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("characters", logger.getMethod()); + assertEquals(new Object[] { ch, 2, 5 }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "ignorableWhitespace", + args = { char[].class, int.class, int.class } + ) + public void testIgnorableWhitespace() { + char[] ch = " ".toCharArray(); + + try { + adapter.ignorableWhitespace(ch, 0, 5); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("ignorableWhitespace", logger.getMethod()); + assertEquals(new Object[] { ch, 0, 5 }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "processingInstruction", + args = { String.class, String.class } + ) + public void testProcessingInstruction() { + try { + adapter.processingInstruction("foo", "bar"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("processingInstruction", logger.getMethod()); + assertEquals(new Object[] { "foo" , "bar" }, logger.getArgs()); + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/ParserFactoryTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/ParserFactoryTest.java new file mode 100644 index 0000000..ebf2a04 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/helpers/ParserFactoryTest.java @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.helpers; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; + +import junit.framework.TestCase; + +import org.xml.sax.helpers.ParserFactory; + +@SuppressWarnings("deprecation") +@TestTargetClass(ParserFactory.class) +public class ParserFactoryTest extends TestCase { + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "makeParser", + args = { }, + notes = "Checks everything except META-INF case" + ) + public void testMakeParser() { + // Property not set at all + try { + ParserFactory.makeParser(); + } catch (NullPointerException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + // Unknown class + System.setProperty("org.xml.sax.parser", "foo.bar.SAXParser"); + + try { + ParserFactory.makeParser(); + } catch (ClassNotFoundException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + // Non-accessible class + System.setProperty("org.xml.sax.parser", + "tests.api.org.xml.sax.support.NoAccessParser"); + + try { + ParserFactory.makeParser(); + } catch (IllegalAccessException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + // Non-instantiable class + System.setProperty("org.xml.sax.parser", + "tests.api.org.xml.sax.support.NoInstanceParser"); + + try { + ParserFactory.makeParser(); + } catch (InstantiationException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + // Non-Parser class + System.setProperty("org.xml.sax.parser", + "tests.api.org.xml.sax.support.NoSubclassParser"); + + try { + ParserFactory.makeParser(); + } catch (ClassCastException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + // Good one, finally + System.setProperty("org.xml.sax.parser", + "tests.api.org.xml.sax.support.DoNothingParser"); + + try { + ParserFactory.makeParser(); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "makeParser", + args = { String.class } + ) + public void testMakeParserString() { + // No class + try { + ParserFactory.makeParser(null); + } catch (NullPointerException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + // Unknown class + try { + ParserFactory.makeParser("foo.bar.SAXParser"); + } catch (ClassNotFoundException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + // Non-accessible class + try { + ParserFactory.makeParser( + "tests.api.org.xml.sax.support.NoAccessParser"); + } catch (IllegalAccessException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + // Non-instantiable class + try { + ParserFactory.makeParser( + "tests.api.org.xml.sax.support.NoInstanceParser"); + } catch (InstantiationException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + // Non-Parser class + try { + ParserFactory.makeParser( + "tests.api.org.xml.sax.support.NoSubclassParser"); + } catch (ClassCastException e) { + // Expected + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + // Good one, finally + try { + ParserFactory.makeParser( + "tests.api.org.xml.sax.support.DoNothingParser"); + } catch (Exception e) { + throw new RuntimeException("Unexpected exception", e); + } + + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLFilterImplTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLFilterImplTest.java new file mode 100644 index 0000000..6586461 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLFilterImplTest.java @@ -0,0 +1,678 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.helpers; + +import java.io.IOException; + +import junit.framework.TestCase; + +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.SAXParseException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.AttributesImpl; +import org.xml.sax.helpers.LocatorImpl; +import org.xml.sax.helpers.XMLFilterImpl; + +import tests.api.org.xml.sax.support.MethodLogger; +import tests.api.org.xml.sax.support.MockFilter; +import tests.api.org.xml.sax.support.MockHandler; +import tests.api.org.xml.sax.support.MockResolver; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; +import dalvik.annotation.TestTargets; + +@TestTargetClass(XMLFilterImpl.class) +public class XMLFilterImplTest extends TestCase { + + // Note: In many cases we can only test that delegation works + // properly. The rest is outside the scope of the specification. + + private MethodLogger logger = new MethodLogger(); + + private MockHandler handler = new MockHandler(logger); + + private XMLFilterImpl parent = new MockFilter(logger); + + private XMLFilterImpl child = new XMLFilterImpl(parent); + + private XMLFilterImpl orphan = new XMLFilterImpl(); + + private void assertEquals(Object[] a, Object[] b) { + assertEquals(a.length, b.length); + + for (int i = 0; i < a.length; i++) { + assertEquals("Element #" + i + " must be equal", a[i], b[i]); + } + } + + public void setUp() { + parent.setContentHandler(handler); + parent.setDTDHandler(handler); + parent.setErrorHandler(handler); + + child.setContentHandler(handler); + child.setDTDHandler(handler); + child.setErrorHandler(handler); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "XMLFilterImpl", + args = { } + ) + public void testXMLFilterImpl() { + assertEquals(null, parent.getParent()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "XMLFilterImpl", + args = { XMLReader.class } + ) + public void testXMLFilterImplXMLReader() { + // Ordinary case + assertEquals(null, parent.getParent()); + + // null case + XMLFilterImpl filter = new XMLFilterImpl(null); + assertEquals(null, filter.getParent()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getParent", + args = { } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setParent", + args = { XMLReader.class } + ) + }) + public void testGetSetParent() { + child.setParent(null); + assertEquals(null, child.getParent()); + + child.setParent(parent); + assertEquals(parent, child.getParent()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getFeature", + args = { String.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setFeature", + args = { String.class, boolean.class } + ) + }) + public void testGetSetFeature() { + // Ordinary case + try { + child.setFeature("foo", true); + assertEquals(true, child.getFeature("foo")); + + child.setFeature("foo", false); + assertEquals(false, child.getFeature("foo")); + } catch (SAXNotRecognizedException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (SAXNotSupportedException e) { + throw new RuntimeException("Unexpected exception", e); + } + + // No parent case + try { + orphan.setFeature("foo", false); + fail("SAXNotRecognizedException expected"); + } catch (SAXNotRecognizedException e) { + // Expected + } catch (SAXNotSupportedException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getProperty", + args = { String.class } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setProperty", + args = { String.class, Object.class } + ) + }) + public void testGetSetProperty() { + // Ordinary case + try { + child.setProperty("foo", "bar"); + assertEquals("bar", child.getProperty("foo")); + + child.setProperty("foo", null); + assertEquals(null, child.getProperty("foo")); + } catch (SAXNotRecognizedException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (SAXNotSupportedException e) { + throw new RuntimeException("Unexpected exception", e); + } + + // No parent case + try { + orphan.setProperty("foo", "bar"); + fail("SAXNotRecognizedException expected"); + } catch (SAXNotRecognizedException e) { + // Expected + } catch (SAXNotSupportedException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getEntityResolver", + args = { } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setEntityResolver", + args = { EntityResolver.class } + ) + }) + public void testGetSetEntityResolver() { + EntityResolver resolver = new MockResolver(); + + parent.setEntityResolver(resolver); + assertEquals(resolver, parent.getEntityResolver()); + + parent.setEntityResolver(null); + assertEquals(null, parent.getEntityResolver()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getDTDHandler", + args = { } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setDTDHandler", + args = { DTDHandler.class } + ) + }) + public void testGetSetDTDHandler() { + parent.setDTDHandler(null); + assertEquals(null, parent.getDTDHandler()); + + parent.setDTDHandler(handler); + assertEquals(handler, parent.getDTDHandler()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getContentHandler", + args = { } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setContentHandler", + args = { ContentHandler.class } + ) + }) + public void testGetSetContentHandler() { + parent.setContentHandler(null); + assertEquals(null, parent.getContentHandler()); + + parent.setContentHandler(handler); + assertEquals(handler, parent.getContentHandler()); + } + + @TestTargets({ + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getErrorHandler", + args = { } + ), + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setErrorHandler", + args = { ErrorHandler.class } + ) + }) + public void testGetSetErrorHandler() { + parent.setErrorHandler(null); + assertEquals(null, parent.getErrorHandler()); + + parent.setErrorHandler(handler); + assertEquals(handler, parent.getErrorHandler()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "parse", + args = { InputSource.class } + ) + public void testParseInputSource() { + InputSource is = new InputSource(); + + // Ordinary case + try { + child.parse(is); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (IOException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(1, logger.size()); + assertEquals("parse", logger.getMethod()); + + // No parent case + try { + orphan.parse(is); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (IOException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "parse", + args = { String.class } + ) + public void testParseString() { + // Ordinary case + try { + child.parse("foo"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (IOException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(1, logger.size()); + assertEquals("parse", logger.getMethod()); + + // No parent case + try { + orphan.parse("foo"); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (IOException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "resolveEntity", + args = { String.class, String.class } + ) + public void testResolveEntity() { + InputSource expected = new InputSource(); + + MockResolver resolver = new MockResolver(); + resolver.addEntity("foo", "bar", expected); + + InputSource result = null; + + parent.setEntityResolver(resolver); + + // Ordinary case + try { + result = parent.resolveEntity("foo", "bar"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (IOException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(expected, result); + + // No entity resolver case + parent.setEntityResolver(null); + + try { + result = parent.resolveEntity("foo", "bar"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (IOException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(null, result); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "notationDecl", + args = { String.class, String.class, String.class } + ) + public void testNotationDecl() { + try { + parent.notationDecl("foo", "bar", "foobar"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("notationDecl", logger.getMethod()); + assertEquals(new Object[] { "foo", "bar", "foobar" }, + logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "unparsedEntityDecl", + args = { String.class, String.class, String.class, String.class } + ) + public void testUnparsedEntityDecl() { + try { + parent.unparsedEntityDecl("foo", "bar", "gabba", "hey"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("unparsedEntityDecl", logger.getMethod()); + assertEquals(new Object[] { "foo", "bar", "gabba", "hey" }, + logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setDocumentLocator", + args = { Locator.class } + ) + public void testSetDocumentLocator() { + Locator l = new LocatorImpl(); + + child.setDocumentLocator(l); + + assertEquals(logger.size(), 1); + assertEquals("setDocumentLocator", logger.getMethod()); + assertEquals(new Object[] { l }, logger.getArgs()); + + child.setDocumentLocator(null); + + assertEquals(logger.size(), 2); + assertEquals("setDocumentLocator", logger.getMethod()); + assertEquals(new Object[] { null }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startDocument", + args = { } + ) + public void testStartDocument() { + try { + parent.startDocument(); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("startDocument", logger.getMethod()); + assertEquals(new Object[] {}, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endDocument", + args = { } + ) + public void testEndDocument() { + try { + parent.endDocument(); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("endDocument", logger.getMethod()); + assertEquals(new Object[] {}, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startPrefixMapping", + args = { String.class, String.class } + ) + public void testStartPrefixMapping() { + try { + parent.startPrefixMapping("foo", "http://some.uri"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("startPrefixMapping", logger.getMethod()); + assertEquals(new Object[] { "foo", "http://some.uri" }, + logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endPrefixMapping", + args = { String.class } + ) + public void testEndPrefixMapping() { + try { + parent.endPrefixMapping("foo"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("endPrefixMapping", logger.getMethod()); + assertEquals(new Object[] { "foo" }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startElement", + args = { String.class, String.class, String.class, Attributes.class } + ) + public void testStartElement() { + Attributes atts = new AttributesImpl(); + + try { + parent.startElement("http://some.uri", "bar", "foo:bar", atts); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("startElement", logger.getMethod()); + assertEquals(new Object[] { "http://some.uri", "bar", "foo:bar", atts }, + logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endElement", + args = { String.class, String.class, String.class } + ) + public void testEndElement() { + try { + parent.endElement("http://some.uri", "bar", "foo:bar"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("endElement", logger.getMethod()); + assertEquals(new Object[] { "http://some.uri", "bar", "foo:bar" }, + logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "characters", + args = { char[].class, int.class, int.class } + ) + public void testCharacters() { + char[] ch = "Android".toCharArray(); + + try { + parent.characters(ch, 2, 5); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("characters", logger.getMethod()); + assertEquals(new Object[] { ch, 2, 5 }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "ignorableWhitespace", + args = { char[].class, int.class, int.class } + ) + public void testIgnorableWhitespace() { + char[] ch = " ".toCharArray(); + + try { + parent.ignorableWhitespace(ch, 0, 5); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("ignorableWhitespace", logger.getMethod()); + assertEquals(new Object[] { ch, 0, 5 }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "processingInstruction", + args = { String.class, String.class } + ) + public void testProcessingInstruction() { + try { + parent.processingInstruction("foo", "bar"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("processingInstruction", logger.getMethod()); + assertEquals(new Object[] { "foo", "bar" }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "skippedEntity", + args = { String.class } + ) + public void testSkippedEntity() { + try { + parent.skippedEntity("foo"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("skippedEntity", logger.getMethod()); + assertEquals(new Object[] { "foo" }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "warning", + args = { SAXParseException.class } + ) + public void testWarning() { + SAXParseException exception = new SAXParseException("Oops!", null); + + try { + parent.warning(exception); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("warning", logger.getMethod()); + assertEquals(new Object[] { exception }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "error", + args = { SAXParseException.class } + ) + public void testError() { + SAXParseException exception = new SAXParseException("Oops!", null); + + try { + parent.error(exception); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("error", logger.getMethod()); + assertEquals(new Object[] { exception }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "fatalError", + args = { SAXParseException.class } + ) + public void testFatalError() { + SAXParseException exception = new SAXParseException("Oops!", null); + + try { + parent.fatalError(exception); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("fatalError", logger.getMethod()); + assertEquals(new Object[] { exception }, logger.getArgs()); + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLReaderAdapterTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLReaderAdapterTest.java new file mode 100644 index 0000000..20488c5 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLReaderAdapterTest.java @@ -0,0 +1,414 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.helpers; + +import java.io.IOException; +import java.util.Locale; + +import junit.framework.TestCase; + +import org.xml.sax.AttributeList; +import org.xml.sax.Attributes; +import org.xml.sax.DTDHandler; +import org.xml.sax.DocumentHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.AttributesImpl; +import org.xml.sax.helpers.LocatorImpl; +import org.xml.sax.helpers.XMLReaderAdapter; + +import tests.api.org.xml.sax.support.MethodLogger; +import tests.api.org.xml.sax.support.MockHandler; +import tests.api.org.xml.sax.support.MockReader; +import tests.api.org.xml.sax.support.MockResolver; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; + +@SuppressWarnings("deprecation") +@TestTargetClass(XMLReaderAdapter.class) +public class XMLReaderAdapterTest extends TestCase { + + // Note: In many cases we can only test that delegation works + // properly. The rest is outside the scope of the specification. + + private MethodLogger logger = new MethodLogger(); + + private MockHandler handler = new MockHandler(logger); + + private XMLReader reader = new MockReader(logger); + + private XMLReaderAdapter adapter = new XMLReaderAdapter(reader); + + private void assertEquals(Object[] a, Object[] b) { + assertEquals(a.length, b.length); + + for (int i = 0; i < a.length; i++) { + assertEquals("Element #" + i + " must be equal", a[i], b[i]); + } + } + + @Override + public void setUp() { + adapter.setDocumentHandler(handler); + adapter.setDTDHandler(handler); + adapter.setErrorHandler(handler); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "XMLReaderAdapter", + args = { } + ) + public void testXMLReaderAdapter() { + System.setProperty("org.xml.sax.driver", + "tests.api.org.xml.sax.support.DoNothingXMLReader"); + + try { + new XMLReaderAdapter(); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "XMLReaderAdapter", + args = { XMLReader.class } + ) + public void testXMLReaderAdapterXMLReader() { + // Ordinary case + @SuppressWarnings("unused") + XMLReaderAdapter adapter = new XMLReaderAdapter(reader); + + // Null case + try { + adapter = new XMLReaderAdapter(null); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setLocale", + args = { Locale.class } + ) + public void testSetLocale() { + // SAX RI does not support this, hence always expect exception + try { + adapter.setLocale(Locale.getDefault()); + fail("SAXException expected"); + } catch (SAXException e) { + // Expected + } + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setEntityResolver", + args = { EntityResolver.class } + ) + public void testSetEntityResolver() { + EntityResolver resolver = new MockResolver(); + + // Ordinary case + adapter.setEntityResolver(resolver); + assertEquals(resolver, reader.getEntityResolver()); + + // null case + adapter.setEntityResolver(null); + assertEquals(null, reader.getEntityResolver()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setDTDHandler", + args = { DTDHandler.class } + ) + public void testSetDTDHandler() { + // Ordinary case + assertEquals(handler, reader.getDTDHandler()); + + // null case + adapter.setDTDHandler(null); + assertEquals(null, reader.getDTDHandler()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setDocumentHandler", + args = { DocumentHandler.class } + ) + public void testSetDocumentHandler() { + // There is no getter for the DocumentHandler, so we can only test + // indirectly whether is has been set correctly. + try { + adapter.startDocument(); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals("startDocument", logger.getMethod()); + assertEquals(new Object[] { }, logger.getArgs()); + + // null case + adapter.setDocumentHandler(null); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setErrorHandler", + args = { ErrorHandler.class } + ) + public void testSetErrorHandler() { + // Ordinary case + assertEquals(handler, reader.getErrorHandler()); + + // null case + adapter.setErrorHandler(null); + assertEquals(null, reader.getErrorHandler()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "parse", + args = { String.class } + ) + public void testParseString() { + try { + adapter.parse("foo"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (IOException e) { + throw new RuntimeException("Unexpected exception", e); + } + + // The SAX RI creates an InputSource itself and then delegates to the + // "other" parse method. + assertEquals("parse", logger.getMethod(0)); + assertEquals(InputSource.class, logger.getArgs(0)[0].getClass()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "parse", + args = { InputSource.class } + ) + public void testParseInputSource() { + InputSource source = new InputSource("foo"); + + try { + adapter.parse(source); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } catch (IOException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals("parse", logger.getMethod()); + assertEquals(new Object[] { source }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "setDocumentLocator", + args = { Locator.class } + ) + public void testSetDocumentLocator() { + // Ordinary case + LocatorImpl locator = new LocatorImpl(); + adapter.setDocumentLocator(locator); + + assertEquals("setDocumentLocator", logger.getMethod()); + assertEquals(new Object[] { locator }, logger.getArgs()); + + // null case (for the DocumentHandler itself!) + adapter.setDocumentHandler(null); + adapter.setDocumentLocator(locator); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startDocument", + args = { } + ) + public void testStartDocument() { + try { + adapter.startDocument(); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("startDocument", logger.getMethod()); + assertEquals(new Object[] {}, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endDocument", + args = { } + ) + public void testEndDocument() { + try { + adapter.endDocument(); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("endDocument", logger.getMethod()); + assertEquals(new Object[] {}, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startPrefixMapping", + args = { String.class, String.class } + ) + public void testStartPrefixMapping() { + adapter.startPrefixMapping("foo", "http://some.uri"); + assertEquals(logger.size(), 0); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endPrefixMapping", + args = { String.class } + ) + public void testEndPrefixMapping() { + adapter.endPrefixMapping("foo"); + assertEquals(logger.size(), 0); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "startElement", + args = { String.class, String.class, String.class, Attributes.class } + ) + public void testStartElement() { + AttributesImpl atts = new AttributesImpl(); + atts.addAttribute("http://some.other.uri", "gabba", "gabba:hey", + "int", "42"); + + try { + adapter.startElement("http://some.uri", "bar", "foo:bar", atts); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("startElement", logger.getMethod()); + assertEquals("foo:bar", logger.getArgs()[0]); + assertEquals("gabba:hey", + ((AttributeList)logger.getArgs()[1]).getName(0)); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "endElement", + args = { String.class, String.class, String.class } + ) + public void testEndElement() { + try { + adapter.endElement("http://some.uri", "bar", "foo:bar"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("endElement", logger.getMethod()); + assertEquals(new Object[] { "foo:bar" }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "characters", + args = { char[].class, int.class, int.class } + ) + public void testCharacters() { + char[] ch = "Android".toCharArray(); + + try { + adapter.characters(ch, 2, 5); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("characters", logger.getMethod()); + assertEquals(new Object[] { ch, 2, 5 }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "ignorableWhitespace", + args = { char[].class, int.class, int.class } + ) + public void testIgnorableWhitespace() { + char[] ch = " ".toCharArray(); + + try { + adapter.ignorableWhitespace(ch, 0, 5); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("ignorableWhitespace", logger.getMethod()); + assertEquals(new Object[] { ch, 0, 5 }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "processingInstruction", + args = { String.class, String.class } + ) + public void testProcessingInstruction() { + try { + adapter.processingInstruction("foo", "bar"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 1); + assertEquals("processingInstruction", logger.getMethod()); + assertEquals(new Object[] { "foo" , "bar" }, logger.getArgs()); + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "skippedEntity", + args = { String.class } + ) + public void testSkippedEntity() { + try { + adapter.skippedEntity("foo"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + assertEquals(logger.size(), 0); + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLReaderFactoryTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLReaderFactoryTest.java new file mode 100644 index 0000000..bfb1bd1 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLReaderFactoryTest.java @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.helpers; + +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetClass; +import dalvik.annotation.TestTargetNew; + +import junit.framework.TestCase; + +import org.xml.sax.SAXException; +import org.xml.sax.helpers.XMLReaderFactory; + +@TestTargetClass(XMLReaderFactory.class) +public class XMLReaderFactoryTest extends TestCase { + + @TestTargetNew( + level = TestLevel.SUFFICIENT, + method = "createXMLReader", + args = { }, + notes = "Checks everything except META-INF case" + ) + public void testCreateXMLReader() { + // Property not set at all + try { + XMLReaderFactory.createXMLReader(); + } catch (SAXException e) { + // Expected + } + + // Unknown class + System.setProperty("org.xml.sax.driver", "foo.bar.XMLReader"); + + try { + XMLReaderFactory.createXMLReader(); + } catch (SAXException e) { + // Expected + } + + // Non-accessible class + System.setProperty("org.xml.sax.driver", + "tests.api.org.xml.sax.support.NoAccessXMLReader"); + + try { + XMLReaderFactory.createXMLReader(); + } catch (SAXException e) { + // Expected + } + + // Non-instantiable class + System.setProperty("org.xml.sax.driver", + "tests.api.org.xml.sax.support.NoInstanceXMLReader"); + + try { + XMLReaderFactory.createXMLReader(); + } catch (SAXException e) { + // Expected + } + + // Non-XMLReader class + System.setProperty("org.xml.sax.driver", + "tests.api.org.xml.sax.support.NoSubclassXMLReader"); + + try { + XMLReaderFactory.createXMLReader(); + } catch (ClassCastException e) { + // Expected + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + // Good one, finally + System.setProperty("org.xml.sax.driver", + "tests.api.org.xml.sax.support.DoNothingXMLReader"); + + try { + XMLReaderFactory.createXMLReader(); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + } + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "createXMLReader", + args = { String.class } + ) + public void testMakeParserString() { + // No class + try { + XMLReaderFactory.createXMLReader(null); + } catch (NullPointerException e) { + // Expected + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + // Unknown class + try { + XMLReaderFactory.createXMLReader("foo.bar.XMLReader"); + } catch (SAXException e) { + // Expected + } + + // Non-accessible class + try { + XMLReaderFactory.createXMLReader( + "tests.api.org.xml.sax.support.NoAccessXMLReader"); + } catch (SAXException e) { + // Expected + } + + // Non-instantiable class + try { + XMLReaderFactory.createXMLReader( + "tests.api.org.xml.sax.support.NoInstanceXMLReader"); + } catch (SAXException e) { + // Expected + } + + // Non-Parser class + try { + XMLReaderFactory.createXMLReader( + "tests.api.org.xml.sax.support.NoSubclassXMLReader"); + } catch (SAXException e) { + // Expected + } + + // Good one, finally + try { + XMLReaderFactory.createXMLReader( + "tests.api.org.xml.sax.support.DoNothingXMLReader"); + } catch (SAXException e) { + throw new RuntimeException("Unexpected exception", e); + } + + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/BrokenInputStream.java b/xml/src/test/java/tests/api/org/xml/sax/support/BrokenInputStream.java new file mode 100644 index 0000000..daa36f9 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/BrokenInputStream.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import java.io.IOException; +import java.io.InputStream; + +/** + * Implements an InputStream what wraps another InputStream and throws an + * IOException after having read a specified number of bytes. Used for + * injecting IOExceptions on lower levels. + */ +public class BrokenInputStream extends InputStream { + + private InputStream stream; + + private int offset; + + public BrokenInputStream(InputStream stream, int offset) { + super(); + + this.stream = stream; + this.offset = offset; + } + + @Override + public int read() throws IOException { + if (offset == 0) { + throw new IOException("Injected exception"); + } + + offset--; + return stream.read(); + } + +}
\ No newline at end of file diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/DoNothingParser.java b/xml/src/test/java/tests/api/org/xml/sax/support/DoNothingParser.java new file mode 100644 index 0000000..6049cc6 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/DoNothingParser.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import org.xml.sax.DTDHandler; +import org.xml.sax.DocumentHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Parser; + +import java.util.Locale; + +/** + * A SAX Parser that does nothing, but can be instantiated properly. + */ +@SuppressWarnings("deprecation") +public class DoNothingParser implements Parser { + + public void parse(InputSource source) { + } + + public void parse(String systemId) { + } + + public void setDocumentHandler(DocumentHandler handler) { + } + + public void setDTDHandler(DTDHandler handler) { + } + + public void setEntityResolver(EntityResolver resolver) { + } + + public void setErrorHandler(ErrorHandler handler) { + } + + public void setLocale(Locale locale) { + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/DoNothingXMLReader.java b/xml/src/test/java/tests/api/org/xml/sax/support/DoNothingXMLReader.java new file mode 100644 index 0000000..8687bff --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/DoNothingXMLReader.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.XMLReader; + +/** + * An XMLReader that does nothing, but can be instantiated properly. + */ +public class DoNothingXMLReader implements XMLReader { + + public ContentHandler getContentHandler() { + return null; + } + + public DTDHandler getDTDHandler() { + return null; + } + + public EntityResolver getEntityResolver() { + return null; + } + + public ErrorHandler getErrorHandler() { + return null; + } + + public boolean getFeature(String name) { + return false; + } + + public Object getProperty(String name) { + return null; + } + + public void parse(InputSource input) { + } + + public void parse(String systemId) { + } + + public void setContentHandler(ContentHandler handler) { + } + + public void setDTDHandler(DTDHandler handler) { + } + + public void setEntityResolver(EntityResolver resolver) { + } + + public void setErrorHandler(ErrorHandler handler) { + } + + public void setFeature(String name, boolean value) { + } + + public void setProperty(String name, Object value) { + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/MethodLogger.java b/xml/src/test/java/tests/api/org/xml/sax/support/MethodLogger.java new file mode 100644 index 0000000..198172b --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/MethodLogger.java @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import java.util.ArrayList; +import java.util.List; + +/** + * A simple helper class that logs method calls by storing method names and + * parameter lists. Used as a foundation for various simple SAX handlers. + */ +public class MethodLogger { + + /** + * The names of the invoked methods, in order. + */ + private List<String> methods = new ArrayList<String>(); + + /** + * The parameter lists of the invoked methods, in order. + */ + private List<Object[]> argLists = new ArrayList<Object[]>(); + + /** + * Adds a method call with a variable list of arguments. + */ + public void add(String method, Object ... args) { + Object[] argsCopy = new Object[args.length]; + System.arraycopy(args, 0, argsCopy, 0, args.length); + + methods.add(method); + argLists.add(argsCopy); + } + + /** + * Returns the number of method invoked so far. + */ + public int size() { + return methods.size(); + } + + /** + * Returns the method name stored at the given index. + */ + public String getMethod(int index) { + return methods.get(index); + } + + /** + * Returns the name of the last method that was invoked. Returns null if no + * method calls have been logged so far. + */ + public String getMethod() { + return (size() == 0 ? null : getMethod(size() - 1)); + } + + /** + * Returns the argument array stored at the given index. May be empty, but + * not null. + */ + public Object[] getArgs(int index) { + return argLists.get(index); + } + + /** + * Returns the argument array of the last method that was invoked. Returns + * null if no method has been invoked so far. + */ + public Object[] getArgs() { + return (size() == 0 ? null : getArgs(size() - 1)); + } + + /** + * Clears the log. + */ + public void clear() { + methods.clear(); + argLists.clear(); + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/MockFilter.java b/xml/src/test/java/tests/api/org/xml/sax/support/MockFilter.java new file mode 100644 index 0000000..0b54bf8 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/MockFilter.java @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.helpers.XMLFilterImpl; + +/** + * A helper class that extends XMLFilterImpl, provides dummy feature/property + * management, and logs some method calls. + */ +public class MockFilter extends XMLFilterImpl { + + private MethodLogger logger; + + private Set<String> features = new HashSet<String>(); + + private Map<String, Object> properties = new HashMap<String, Object>(); + + public MockFilter(MethodLogger logger) { + super(); + this.logger = logger; + } + + @Override + public boolean getFeature(String name) throws SAXNotRecognizedException, + SAXNotSupportedException { + return features.contains(name); + } + + @Override + public Object getProperty(String name) throws SAXNotRecognizedException, + SAXNotSupportedException { + return properties.get(name); + } + + @Override + public void setFeature(String name, boolean value) { + if (value) { + features.add(name); + } else { + features.remove(name); + } + } + + @Override + public void setProperty(String name, Object value) throws SAXNotRecognizedException, + SAXNotSupportedException { + if (value == null) { + properties.remove(name); + } else { + properties.put(name, value); + } + } + + @Override + public void parse(InputSource input) throws SAXException, IOException { + logger.add("parse", input); + } + + @Override + public void parse(String systemId) throws SAXException, IOException { + logger.add("parse", systemId); + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/MockHandler.java b/xml/src/test/java/tests/api/org/xml/sax/support/MockHandler.java new file mode 100644 index 0000000..98b024a --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/MockHandler.java @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import org.xml.sax.AttributeList; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.DocumentHandler; +import org.xml.sax.ErrorHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.ext.LexicalHandler; + +/** + * A helper class that implements the various SAX callback interfaces and logs + * method calls. + */ +@SuppressWarnings("deprecation") +public class MockHandler implements ContentHandler, DTDHandler, DocumentHandler, + ErrorHandler, LexicalHandler { + + private MethodLogger logger; + + public MockHandler(MethodLogger logger) { + super(); + this.logger = logger; + } + + public void characters(char[] ch, int start, int length) throws SAXException { + logger.add("characters", ch, start, length); + } + + public void endDocument() throws SAXException { + logger.add("endDocument"); + } + + public void endElement(String name) throws SAXException { + logger.add("endElement", name); + } + + public void endElement(String uri, String localName, String name) throws SAXException { + logger.add("endElement", uri, localName, name); + } + + public void endPrefixMapping(String prefix) throws SAXException { + logger.add("endPrefixMapping", prefix); + } + + public void error(SAXParseException exception) throws SAXException { + logger.add("error", exception); + } + + public void fatalError(SAXParseException exception) throws SAXException { + logger.add("fatalError", exception); + } + + public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { + logger.add("ignorableWhitespace", ch, start, length); + } + + public void notationDecl(String name, String publicId, String systemId) throws SAXException { + logger.add("notationDecl", name, publicId, systemId); + } + + public void processingInstruction(String target, String data) throws SAXException { + logger.add("processingInstruction", target, data); + } + + public void setDocumentLocator(Locator locator) { + logger.add("setDocumentLocator", locator); + } + + public void skippedEntity(String name) throws SAXException { + logger.add("skippedEntity", name); + } + + public void startDocument() throws SAXException { + logger.add("startDocument"); + } + + public void startElement(String name, AttributeList atts) throws SAXException { + logger.add("startElement", name, atts); + } + + public void startElement(String uri, String localName, String name, Attributes atts) + throws SAXException { + logger.add("startElement", uri, localName, name, atts); + } + + public void startPrefixMapping(String prefix, String uri) throws SAXException { + logger.add("startPrefixMapping", prefix, uri); + } + + public void unparsedEntityDecl(String name, String publicId, String systemId, + String notationName) throws SAXException { + logger.add("unparsedEntityDecl", name, publicId, systemId, notationName); + } + + public void warning(SAXParseException exception) throws SAXException { + logger.add("warning", exception); + } + + public void comment(char[] ch, int start, int length) throws SAXException { + logger.add("comment", ch, start, length); + } + + public void endCDATA() throws SAXException { + logger.add("endCDATA"); + } + + public void endDTD() throws SAXException { + logger.add("endDTD"); + } + + public void endEntity(String name) throws SAXException { + logger.add("endEntity", name); + } + + public void startCDATA() throws SAXException { + logger.add("startCDATA"); + } + + public void startDTD(String name, String publicId, String systemId) throws SAXException { + logger.add("startDTD", name, publicId, systemId); + } + + public void startEntity(String name) throws SAXException { + logger.add("startEntity", name); + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/MockParser.java b/xml/src/test/java/tests/api/org/xml/sax/support/MockParser.java new file mode 100644 index 0000000..01520f8 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/MockParser.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import java.io.IOException; +import java.util.Locale; + +import org.xml.sax.DTDHandler; +import org.xml.sax.DocumentHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Parser; +import org.xml.sax.SAXException; + +@SuppressWarnings("deprecation") +public class MockParser implements Parser { + + private MethodLogger logger; + + public MockParser(MethodLogger logger) { + super(); + this.logger = logger; + } + + public void parse(InputSource source) throws SAXException, IOException { + logger.add("parse", source); + } + + public void parse(String systemId) throws SAXException, IOException { + logger.add("parse", systemId); + } + + public void setDTDHandler(DTDHandler handler) { + logger.add("setDTDHandler", handler); + } + + public void setDocumentHandler(DocumentHandler handler) { + logger.add("setDocumentHandler", handler); + } + + public void setEntityResolver(EntityResolver resolver) { + logger.add("setEntityResolver", resolver); + } + + public void setErrorHandler(ErrorHandler handler) { + logger.add("setErrorHandler", handler); + } + + public void setLocale(Locale locale) throws SAXException { + logger.add("setLocale", locale); + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/MockReader.java b/xml/src/test/java/tests/api/org/xml/sax/support/MockReader.java new file mode 100644 index 0000000..22a6a57 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/MockReader.java @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.XMLReader; + +/** + * A helper class that implements the SAX XMLReader interface and logs method + * calls. + */ +public class MockReader implements XMLReader { + + private MethodLogger logger; + + private ContentHandler contentHandler; + + private DTDHandler dtdHandler; + + private EntityResolver resolver; + + private ErrorHandler errorHandler; + + private Set<String> features = new HashSet<String>(); + + private Map<String, Object> properties = new HashMap<String, Object>(); + + public MockReader(MethodLogger logger) { + super(); + this.logger = logger; + } + + + public ContentHandler getContentHandler() { + return contentHandler; + } + + public DTDHandler getDTDHandler() { + return dtdHandler; + } + + public EntityResolver getEntityResolver() { + return resolver; + } + + public ErrorHandler getErrorHandler() { + return errorHandler; + } + + public boolean getFeature(String name) throws SAXNotRecognizedException, + SAXNotSupportedException { + return features.contains(name); + } + + public Object getProperty(String name) throws SAXNotRecognizedException, + SAXNotSupportedException { + return properties.get(name); + } + + public void parse(InputSource input) throws IOException, SAXException { + logger.add("parse", input); + } + + public void parse(String systemId) throws IOException, SAXException { + logger.add("parse", systemId); + } + + public void setContentHandler(ContentHandler handler) { + this.contentHandler = handler; + } + + public void setDTDHandler(DTDHandler handler) { + this.dtdHandler = handler; + } + + public void setEntityResolver(EntityResolver resolver) { + this.resolver = resolver; + } + + public void setErrorHandler(ErrorHandler handler) { + this.errorHandler = handler; + } + + public void setFeature(String name, boolean value) { + if (value) { + features.add(name); + } else { + features.remove(name); + } + } + + public void setProperty(String name, Object value) throws SAXNotRecognizedException, + SAXNotSupportedException { + if (value == null) { + properties.remove(name); + } else { + properties.put(name, value); + } + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/MockResolver.java b/xml/src/test/java/tests/api/org/xml/sax/support/MockResolver.java new file mode 100644 index 0000000..ae0066e --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/MockResolver.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * A helper class for resolving entities. + */ +public class MockResolver implements EntityResolver { + + private Map<String, InputSource> entities = new HashMap<String, InputSource>(); + + public void addEntity(String publicId, String systemId, InputSource source) { + entities.put("[" + publicId + ":" + systemId + "]", source); + } + + public void removeEntity(String publicId, String systemId) { + entities.remove("[" + publicId + ":" + systemId + "]"); + } + + public InputSource resolveEntity(String publicId, String systemId) + throws SAXException, IOException { + return entities.get("[" + publicId + ":" + systemId + "]"); + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/NoAccessParser.java b/xml/src/test/java/tests/api/org/xml/sax/support/NoAccessParser.java new file mode 100644 index 0000000..5aac9af --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/NoAccessParser.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import org.xml.sax.DTDHandler; +import org.xml.sax.DocumentHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Parser; + +import java.util.Locale; + +/** + * A SAX Parser that can't be accessed. + */ +@SuppressWarnings("deprecation") +class NoAccessParser implements Parser { + + public void parse(InputSource source) { + } + + public void parse(String systemId) { + } + + public void setDocumentHandler(DocumentHandler handler) { + } + + public void setDTDHandler(DTDHandler handler) { + } + + public void setEntityResolver(EntityResolver resolver) { + } + + public void setErrorHandler(ErrorHandler handler) { + } + + public void setLocale(Locale locale) { + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/NoAccessXMLReader.java b/xml/src/test/java/tests/api/org/xml/sax/support/NoAccessXMLReader.java new file mode 100644 index 0000000..b6a0a68 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/NoAccessXMLReader.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.XMLReader; + +/** + * An XMLReader that is not accessible. + */ +class NoAccessXMLReader implements XMLReader { + + public ContentHandler getContentHandler() { + return null; + } + + public DTDHandler getDTDHandler() { + return null; + } + + public EntityResolver getEntityResolver() { + return null; + } + + public ErrorHandler getErrorHandler() { + return null; + } + + public boolean getFeature(String name) { + return false; + } + + public Object getProperty(String name) { + return null; + } + + public void parse(InputSource input) { + } + + public void parse(String systemId) { + } + + public void setContentHandler(ContentHandler handler) { + } + + public void setDTDHandler(DTDHandler handler) { + } + + public void setEntityResolver(EntityResolver resolver) { + } + + public void setErrorHandler(ErrorHandler handler) { + } + + public void setFeature(String name, boolean value) { + } + + public void setProperty(String name, Object value) { + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/NoInstanceParser.java b/xml/src/test/java/tests/api/org/xml/sax/support/NoInstanceParser.java new file mode 100644 index 0000000..8f1692f --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/NoInstanceParser.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import org.xml.sax.DTDHandler; +import org.xml.sax.DocumentHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Parser; + +import java.util.Locale; + +/** + * A SAX Parser that can be accessed, but not instantiated. + */ +@SuppressWarnings("deprecation") +public class NoInstanceParser implements Parser { + + public NoInstanceParser(int i) { + } + + public void parse(InputSource source) { + } + + public void parse(String systemId) { + } + + public void setDocumentHandler(DocumentHandler handler) { + } + + public void setDTDHandler(DTDHandler handler) { + } + + public void setEntityResolver(EntityResolver resolver) { + } + + public void setErrorHandler(ErrorHandler handler) { + } + + public void setLocale(Locale locale) { + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/NoInstanceXMLReader.java b/xml/src/test/java/tests/api/org/xml/sax/support/NoInstanceXMLReader.java new file mode 100644 index 0000000..764c451 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/NoInstanceXMLReader.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.XMLReader; + +/** + * An XMLReader that is accessible, but can't be instantiated. + */ +public class NoInstanceXMLReader implements XMLReader { + + public NoInstanceXMLReader(int i) { + } + + public ContentHandler getContentHandler() { + return null; + } + + public DTDHandler getDTDHandler() { + return null; + } + + public EntityResolver getEntityResolver() { + return null; + } + + public ErrorHandler getErrorHandler() { + return null; + } + + public boolean getFeature(String name) { + return false; + } + + public Object getProperty(String name) { + return null; + } + + public void parse(InputSource input) { + } + + public void parse(String systemId) { + } + + public void setContentHandler(ContentHandler handler) { + } + + public void setDTDHandler(DTDHandler handler) { + } + + public void setEntityResolver(EntityResolver resolver) { + } + + public void setErrorHandler(ErrorHandler handler) { + } + + public void setFeature(String name, boolean value) { + } + + public void setProperty(String name, Object value) { + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/NoSubclassParser.java b/xml/src/test/java/tests/api/org/xml/sax/support/NoSubclassParser.java new file mode 100644 index 0000000..f178998 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/NoSubclassParser.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import org.xml.sax.DTDHandler; +import org.xml.sax.DocumentHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; + +import java.util.Locale; + +/** + * A SAX Parser that does not implement the Parser interface. + */ +@SuppressWarnings("deprecation") +public class NoSubclassParser { + + public void parse(InputSource source) { + } + + public void parse(String systemId) { + } + + public void setDocumentHandler(DocumentHandler handler) { + } + + public void setDTDHandler(DTDHandler handler) { + } + + public void setEntityResolver(EntityResolver resolver) { + } + + public void setErrorHandler(ErrorHandler handler) { + } + + public void setLocale(Locale locale) { + } + +} diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/NoSubclassXMLReader.java b/xml/src/test/java/tests/api/org/xml/sax/support/NoSubclassXMLReader.java new file mode 100644 index 0000000..acdbd88 --- /dev/null +++ b/xml/src/test/java/tests/api/org/xml/sax/support/NoSubclassXMLReader.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.api.org.xml.sax.support; + +import org.xml.sax.ContentHandler; +import org.xml.sax.DTDHandler; +import org.xml.sax.EntityResolver; +import org.xml.sax.ErrorHandler; +import org.xml.sax.InputSource; +import org.xml.sax.XMLReader; + +/** + * An XMLReader that does not implement the XMLReader interface. + */ +public class NoSubclassXMLReader implements XMLReader { + + public ContentHandler getContentHandler() { + return null; + } + + public DTDHandler getDTDHandler() { + return null; + } + + public EntityResolver getEntityResolver() { + return null; + } + + public ErrorHandler getErrorHandler() { + return null; + } + + public boolean getFeature(String name) { + return false; + } + + public Object getProperty(String name) { + return null; + } + + public void parse(InputSource input) { + } + + public void parse(String systemId) { + } + + public void setContentHandler(ContentHandler handler) { + } + + public void setDTDHandler(DTDHandler handler) { + } + + public void setEntityResolver(EntityResolver resolver) { + } + + public void setErrorHandler(ErrorHandler handler) { + } + + public void setFeature(String name, boolean value) { + } + + public void setProperty(String name, Object value) { + } + +} diff --git a/xml/src/test/java/tests/org/w3c/dom/AllTests.java b/xml/src/test/java/tests/org/w3c/dom/AllTests.java index 93ab566..a4299a7 100644 --- a/xml/src/test/java/tests/org/w3c/dom/AllTests.java +++ b/xml/src/test/java/tests/org/w3c/dom/AllTests.java @@ -30,7 +30,7 @@ public class AllTests { } public static Test suite() { - TestSuite suite = new TestSuite("All tests for package org.w3c.dom;"); + TestSuite suite = tests.TestSuiteFactory.createTestSuite("All tests for package org.w3c.dom;"); // $JUnit-BEGIN$ suite.addTestSuite(AttrGetOwnerElement.class); @@ -54,11 +54,9 @@ public class AllTests { suite.addTestSuite(ElementGetAttributeNodeNS.class); suite.addTestSuite(ElementGetElementsByTagNameNS.class); suite.addTestSuite(ElementHasAttribute.class); -// Has one failing test due to KXML limitation. suite.addTestSuite(ElementHasAttributeNS.class); suite.addTestSuite(ElementRemoveAttributeNS.class); suite.addTestSuite(ElementSetAttributeNS.class); -// Has one failing test due to attribute limitation. suite.addTestSuite(ElementSetAttributeNodeNS.class); suite.addTestSuite(GetAttributeNS.class); suite.addTestSuite(GetAttributeNodeNS.class); @@ -78,13 +76,11 @@ public class AllTests { suite.addTestSuite(HasAttribute.class); suite.addTestSuite(HasAttributeNS.class); suite.addTestSuite(HasAttributes.class); -// Has one failure due to attribute limitation. suite.addTestSuite(ImportNode.class); suite.addTestSuite(InternalSubset.class); suite.addTestSuite(IsSupported.class); suite.addTestSuite(LocalName.class); suite.addTestSuite(NamedNodeMapGetNamedItemNS.class); -// Has one failing test due to KXML limitation. suite.addTestSuite(NamedNodeMapRemoveNamedItemNS.class); suite.addTestSuite(NamedNodeMapSetNamedItemNS.class); suite.addTestSuite(NamespaceURI.class); @@ -95,12 +91,10 @@ public class AllTests { suite.addTestSuite(NodeHasAttributes.class); suite.addTestSuite(NodeIsSupported.class); suite.addTestSuite(NodeNormalize.class); -// Has one failure due to a strange exception requirement. suite.addTestSuite(NodeSetPrefix.class); suite.addTestSuite(Normalize.class); suite.addTestSuite(OwnerDocument.class); suite.addTestSuite(OwnerElement.class); -// Has two failing tests due to KXML limitation and strange exception requirements. suite.addTestSuite(Prefix.class); suite.addTestSuite(PublicId.class); // Is empty. Only test assumes validation. Leave disabled. diff --git a/xml/src/test/java/tests/org/w3c/dom/AttrGetOwnerElement.java b/xml/src/test/java/tests/org/w3c/dom/AttrGetOwnerElement.java index 6f0e4e4..bb42121 100644 --- a/xml/src/test/java/tests/org/w3c/dom/AttrGetOwnerElement.java +++ b/xml/src/test/java/tests/org/w3c/dom/AttrGetOwnerElement.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Attr; @@ -61,16 +61,12 @@ public final class AttrGetOwnerElement extends DOMTestCase { // assertEquals("attrgetownerelement01", "emp:employee", ownerElementName); // // } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify that getOwnerElement returns null " + - "if an attribute is not in use.", - targets = { - @TestTarget( - methodName = "getOwnerElement", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify that getOwnerElement returns null if an attribute is not in use.", + method = "getOwnerElement", + args = {} + ) public void testGetOwnerElement2() throws Throwable { Document doc; Element element; @@ -86,16 +82,12 @@ public final class AttrGetOwnerElement extends DOMTestCase { ownerElementName = ownerElement.getNodeName(); assertEquals("attrgetownerelement02", "root", ownerElementName); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that getOwnerElement returns null " + - "if an attribute is not in use.", - targets = { - @TestTarget( - methodName = "getOwnerElement", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that getOwnerElement returns null if an attribute is not in use.", + method = "getOwnerElement", + args = {} + ) public void testGetOwnerElement3() throws Throwable { Document doc; Node ownerElement; @@ -105,16 +97,12 @@ public final class AttrGetOwnerElement extends DOMTestCase { ownerElement = attr.getOwnerElement(); assertNull("attrgetownerelement03", ownerElement); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that getOwnerElement returns null " + - "if an attribute is not in use.", - targets = { - @TestTarget( - methodName = "getOwnerElement", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that getOwnerElement returns null if an attribute is not in use.", + method = "getOwnerElement", + args = {} + ) public void testGetOwnerElement4() throws Throwable { Document doc; Document docImp; @@ -136,16 +124,12 @@ public final class AttrGetOwnerElement extends DOMTestCase { ownerElement = attrImp.getOwnerElement(); assertNull("attrgetownerelement04", ownerElement); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify that getOwnerElement returns null " + - "if an attribute is not in use.", - targets = { - @TestTarget( - methodName = "getOwnerElement", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify that getOwnerElement returns null if an attribute is not in use.", + method = "getOwnerElement", + args = {} + ) public void testGetOwnerElement5() throws Throwable { Document doc; Node element; diff --git a/xml/src/test/java/tests/org/w3c/dom/CreateAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/CreateAttributeNS.java index dbbba95..c7e0d34 100644 --- a/xml/src/test/java/tests/org/w3c/dom/CreateAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/CreateAttributeNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.ArrayList; @@ -65,15 +65,12 @@ public final class CreateAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies NAMESPACE_ERR exception code.", - targets = { - @TestTarget( - methodName = "createAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies NAMESPACE_ERR exception code.", + method = "createAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateAttributeNS1() throws Throwable { String namespaceURI = "http://www.ecommerce.org/"; String malformedName = "prefix::local"; @@ -91,16 +88,12 @@ public final class CreateAttributeNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies createAttributeNS method with null as the fisrt " + - "parameter.", - targets = { - @TestTarget( - methodName = "createAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies createAttributeNS method with null as the fisrt parameter.", + method = "createAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateAttributeNS2() throws Throwable { String namespaceURI = null; @@ -119,15 +112,12 @@ public final class CreateAttributeNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that createAttributeNS throws DOMException.", - targets = { - @TestTarget( - methodName = "createAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that createAttributeNS throws DOMException.", + method = "createAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateAttributeNS3() throws Throwable { String namespaceURI = "http://www.wedding.com/"; String qualifiedName; @@ -176,15 +166,12 @@ public final class CreateAttributeNS extends DOMTestCase { } } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify exceptions.", - targets = { - @TestTarget( - methodName = "createAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify exceptions.", + method = "createAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateAttributeNS4() throws Throwable { String namespaceURI = "http://www.w3.org/XML/1998/namespaces"; String qualifiedName = "xml:attr1"; @@ -202,15 +189,12 @@ public final class CreateAttributeNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify exceptions.", - targets = { - @TestTarget( - methodName = "createAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify exceptions.", + method = "createAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateAttributeNS5() throws Throwable { String namespaceURI = "http://www.ecommerce.org/"; String qualifiedName = "econm:local"; @@ -222,15 +206,12 @@ public final class CreateAttributeNS extends DOMTestCase { attrName = newAttr.getName(); assertEquals("throw_Equals", qualifiedName, attrName); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "", - targets = { - @TestTarget( - methodName = "createAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "", + method = "createAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateAttributeNS6() throws Throwable { String namespaceURI = "http://www.example.com/"; Document doc; diff --git a/xml/src/test/java/tests/org/w3c/dom/CreateDocument.java b/xml/src/test/java/tests/org/w3c/dom/CreateDocument.java index 56ffedc..157b394 100644 --- a/xml/src/test/java/tests/org/w3c/dom/CreateDocument.java +++ b/xml/src/test/java/tests/org/w3c/dom/CreateDocument.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.ArrayList; @@ -86,15 +86,12 @@ public final class CreateDocument extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify null as parameters.", - targets = { - @TestTarget( - methodName = "createDocument", - methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify null as parameters.", + method = "createDocument", + args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) public void testCreateDocument1() throws Throwable { String namespaceURI = "http://www.ecommerce.org/"; String malformedName = "prefix::local"; @@ -115,15 +112,12 @@ public final class CreateDocument extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify null as parameters.", - targets = { - @TestTarget( - methodName = "createDocument", - methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify null as parameters.", + method = "createDocument", + args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) public void testCreateDocument2() throws Throwable { String namespaceURI = null; @@ -189,15 +183,12 @@ public final class CreateDocument extends DOMTestCase { // assertTrue("throw_WRONG_DOCUMENT_ERR", success); // // } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify null as parameters.", - targets = { - @TestTarget( - methodName = "createDocument", - methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify null as parameters.", + method = "createDocument", + args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) public void testCreateDocument5() throws Throwable { String namespaceURI = "http://www.ecommerce.org/schema"; String qualifiedName; @@ -250,15 +241,12 @@ public final class CreateDocument extends DOMTestCase { } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify null as parameters.", - targets = { - @TestTarget( - methodName = "createDocument", - methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify null as parameters.", + method = "createDocument", + args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) public void testCreateDocument6() throws Throwable { String namespaceURI = "http://ecommerce.org/schema"; String qualifiedName = "xml:local"; @@ -279,15 +267,12 @@ public final class CreateDocument extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify null as parameters.", - targets = { - @TestTarget( - methodName = "createDocument", - methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify null as parameters.", + method = "createDocument", + args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) public void testCreateDocument7() throws Throwable { String namespaceURI = "http://www.ecommerce.org/schema"; String qualifiedName = "y:x"; @@ -306,15 +291,12 @@ public final class CreateDocument extends DOMTestCase { assertEquals("nodeName", "#document", nodeName); assertNull("nodeValue", nodeValue); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify null as parameters.", - targets = { - @TestTarget( - methodName = "createDocument", - methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify null as parameters.", + method = "createDocument", + args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) public void testCreateDocument8() throws Throwable { String namespaceURI = "http://www.example.org/schema"; DocumentType docType = null; diff --git a/xml/src/test/java/tests/org/w3c/dom/CreateDocumentType.java b/xml/src/test/java/tests/org/w3c/dom/CreateDocumentType.java index 3d69200..c5061b8 100644 --- a/xml/src/test/java/tests/org/w3c/dom/CreateDocumentType.java +++ b/xml/src/test/java/tests/org/w3c/dom/CreateDocumentType.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.ArrayList; @@ -86,15 +86,12 @@ public final class CreateDocumentType extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify null as parameters.", - targets = { - @TestTarget( - methodName = "createDocumentType", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify null as parameters.", + method = "createDocumentType", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testCreateDocumentType1() throws Throwable { String publicId = "STAFF"; String systemId = "staff.xml"; @@ -115,15 +112,12 @@ public final class CreateDocumentType extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify null as parameters.", - targets = { - @TestTarget( - methodName = "createDocumentType", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify null as parameters.", + method = "createDocumentType", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testCreateDocumentType2() throws Throwable { String publicId = "http://www.localhost.com/"; String systemId = "myDoc.dtd"; @@ -177,15 +171,12 @@ public final class CreateDocumentType extends DOMTestCase { } } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify null as parameters.", - targets = { - @TestTarget( - methodName = "createDocumentType", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify null as parameters.", + method = "createDocumentType", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testCreateDocumentType3() throws Throwable { String qualifiedName = "prefix:myDoc"; @@ -205,15 +196,12 @@ public final class CreateDocumentType extends DOMTestCase { nodeValue = newType.getNodeValue(); assertNull("nodeValue", nodeValue); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify null as parameters.", - targets = { - @TestTarget( - methodName = "createDocumentType", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify null as parameters.", + method = "createDocumentType", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testCreateDocumentType4() throws Throwable { String publicId = "http://www.example.com/"; String systemId = "myDoc.dtd"; diff --git a/xml/src/test/java/tests/org/w3c/dom/CreateElementNS.java b/xml/src/test/java/tests/org/w3c/dom/CreateElementNS.java index acb79c3..8d8bb4d 100644 --- a/xml/src/test/java/tests/org/w3c/dom/CreateElementNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/CreateElementNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.ArrayList; @@ -83,16 +83,12 @@ public final class CreateElementNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify null as a parameters, and other types of " + - "DOMException.", - targets = { - @TestTarget( - methodName = "createElementNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify null as a parameters, and other types of DOMException.", + method = "createElementNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateElementNS1() throws Throwable { String namespaceURI = "http://www.ecommerce.org/"; String malformedName = "prefix::local"; @@ -110,16 +106,12 @@ public final class CreateElementNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify null as a parameters, and other types of " + - "DOMException.", - targets = { - @TestTarget( - methodName = "createElementNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify null as a parameters, and other types of DOMException.", + method = "createElementNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateElementNS2() throws Throwable { String namespaceURI = null; @@ -138,16 +130,12 @@ public final class CreateElementNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify null as a parameters, and other types of " + - "DOMException.", - targets = { - @TestTarget( - methodName = "createElementNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify null as a parameters, and other types of DOMException.", + method = "createElementNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateElementNS3() throws Throwable { String namespaceURI = "http://www.wedding.com/"; String qualifiedName; @@ -197,16 +185,12 @@ public final class CreateElementNS extends DOMTestCase { } } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify null as a parameters, and other types of " + - "DOMException.", - targets = { - @TestTarget( - methodName = "createElementNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify null as a parameters, and other types of DOMException.", + method = "createElementNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateElementNS4() throws Throwable { String namespaceURI = "http://www.w3.org/XML/1998/namespaces"; String qualifiedName = "xml:element1"; @@ -224,16 +208,12 @@ public final class CreateElementNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify null as a parameters, and other types of " + - "DOMException.", - targets = { - @TestTarget( - methodName = "createElementNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify null as a parameters, and other types of DOMException.", + method = "createElementNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateElementNS5() throws Throwable { String namespaceURI = "http://www.nist.gov"; String qualifiedName = "gov:faculty"; @@ -245,16 +225,12 @@ public final class CreateElementNS extends DOMTestCase { elementName = newElement.getTagName(); assertEquals("throw_Equals", qualifiedName, elementName); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify null as a parameters, and other types of " + - "DOMException.", - targets = { - @TestTarget( - methodName = "createElementNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify null as a parameters, and other types of DOMException.", + method = "createElementNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateElementNS6() throws Throwable { String namespaceURI = "http://www.example.com/"; diff --git a/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocument.java b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocument.java index fed32b8..d2650a4 100644 --- a/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocument.java +++ b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocument.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.ArrayList; @@ -58,15 +58,12 @@ public final class DOMImplementationCreateDocument extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "createDocument", - methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "createDocument", + args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) public void testCreateDocument3() throws Throwable { Document doc; DOMImplementation domImpl; @@ -96,15 +93,12 @@ public final class DOMImplementationCreateDocument extends DOMTestCase { assertNotNull("domimplementationcreatedocument03", newDoc); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies DOMException with NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "createDocument", - methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies DOMException with NAMESPACE_ERR code.", + method = "createDocument", + args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) public void testCreateDocument4() throws Throwable { Document doc; DOMImplementation domImpl; @@ -127,15 +121,12 @@ public final class DOMImplementationCreateDocument extends DOMTestCase { assertTrue("domimplementationcreatedocument04", success); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies DOMException with NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "createDocument", - methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies DOMException with NAMESPACE_ERR code.", + method = "createDocument", + args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) public void testCreateDocument5() throws Throwable { Document doc; DOMImplementation domImpl; @@ -157,15 +148,12 @@ public final class DOMImplementationCreateDocument extends DOMTestCase { assertTrue("domimplementationcreatedocument05", success); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies DOMException with NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "createDocument", - methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies DOMException with NAMESPACE_ERR code.", + method = "createDocument", + args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) public void testCreateDocument7() throws Throwable { Document doc; DOMImplementation domImpl; diff --git a/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocumentType.java b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocumentType.java index 6957b5b..286e75d 100644 --- a/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocumentType.java +++ b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocumentType.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.ArrayList; @@ -78,15 +78,12 @@ public final class DOMImplementationCreateDocumentType extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "createDocumentType", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "createDocumentType", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testCreateDocumentType1() throws Throwable { Document doc; DOMImplementation domImpl; @@ -121,15 +118,12 @@ public final class DOMImplementationCreateDocumentType extends DOMTestCase { } } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "createDocumentType", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "createDocumentType", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testCreateDocumentType2() throws Throwable { Document doc; DOMImplementation domImpl; @@ -167,15 +161,12 @@ public final class DOMImplementationCreateDocumentType extends DOMTestCase { ownerDocument); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "createDocumentType", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "createDocumentType", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testCreateDocumentType4() throws Throwable { Document doc; DOMImplementation domImpl; diff --git a/xml/src/test/java/tests/org/w3c/dom/DOMImplementationHasFeature.java b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationHasFeature.java index b5074ad..257555b 100644 --- a/xml/src/test/java/tests/org/w3c/dom/DOMImplementationHasFeature.java +++ b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationHasFeature.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.ArrayList; @@ -58,15 +58,12 @@ public final class DOMImplementationHasFeature extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that hasFeature returns true value.", - targets = { - @TestTarget( - methodName = "hasFeature", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that hasFeature returns true value.", + method = "hasFeature", + args = {java.lang.String.class, java.lang.String.class} + ) public void testHasFeatureCore() throws Throwable { Document doc; DOMImplementation domImpl; @@ -76,15 +73,12 @@ public final class DOMImplementationHasFeature extends DOMTestCase { state = domImpl.hasFeature("core", "2.0"); assertTrue("domimplementationFeaturecoreAssert", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that hasFeature returns true value.", - targets = { - @TestTarget( - methodName = "hasFeature", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that hasFeature returns true value.", + method = "hasFeature", + args = {java.lang.String.class, java.lang.String.class} + ) public void testHasFeatureXml() throws Throwable { Document doc; DOMImplementation domImpl; @@ -94,15 +88,12 @@ public final class DOMImplementationHasFeature extends DOMTestCase { state = domImpl.hasFeature("xml", "2.0"); assertTrue("domimplementationFeaturexmlVersion2Assert", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify that hasFeature method returns false.", - targets = { - @TestTarget( - methodName = "hasFeature", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify that hasFeature method returns false.", + method = "hasFeature", + args = {java.lang.String.class, java.lang.String.class} + ) public void testHasFeature1() throws Throwable { Document doc; DOMImplementation domImpl; @@ -138,15 +129,12 @@ public final class DOMImplementationHasFeature extends DOMTestCase { assertTrue("domimplementationhasfeature01_Core_3", success); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that hasFeature method returns false.", - targets = { - @TestTarget( - methodName = "hasFeature", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that hasFeature method returns false.", + method = "hasFeature", + args = {java.lang.String.class, java.lang.String.class} + ) public void testHasFeature2() throws Throwable { Document doc; DOMImplementation domImpl; diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentCreateAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/DocumentCreateAttributeNS.java index 5b818e6..e46f3b3 100644 --- a/xml/src/test/java/tests/org/w3c/dom/DocumentCreateAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentCreateAttributeNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.ArrayList; @@ -82,15 +82,12 @@ public final class DocumentCreateAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive functionality.", - targets = { - @TestTarget( - methodName = "createAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive functionality.", + method = "createAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateAttributeNS1() throws Throwable { Document doc; Attr attribute; @@ -113,15 +110,12 @@ public final class DocumentCreateAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive functionality.", - targets = { - @TestTarget( - methodName = "createAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive functionality.", + method = "createAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateAttributeNS2() throws Throwable { Document doc; Attr attribute1; @@ -162,16 +156,12 @@ public final class DocumentCreateAttributeNS extends DOMTestCase { assertEquals("documentcreateattributeNS02_att2_namespaceURI", "http://www.w3.org/2000/xmlns/", namespaceURI); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that createAttributeNS throws DOMException with " + - "INVALID_CHARACTER_ERR code.", - targets = { - @TestTarget( - methodName = "createAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that createAttributeNS throws DOMException with INVALID_CHARACTER_ERR code.", + method = "createAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateAttributeNS3() throws Throwable { Document doc; @@ -203,16 +193,12 @@ public final class DocumentCreateAttributeNS extends DOMTestCase { } } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that createAttributeNS throws DOMException with " + - "NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "createAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that createAttributeNS throws DOMException with NAMESPACE_ERR code.", + method = "createAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateAttributeNS4() throws Throwable { Document doc; @@ -240,16 +226,12 @@ public final class DocumentCreateAttributeNS extends DOMTestCase { } } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that createAttributeNS throws DOMException with " + - "NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "createAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that createAttributeNS throws DOMException with NAMESPACE_ERR code.", + method = "createAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateAttributeNS5() throws Throwable { Document doc; Document newDoc; @@ -275,16 +257,12 @@ public final class DocumentCreateAttributeNS extends DOMTestCase { assertTrue("documentcreateattributeNS05", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that createAttributeNS throws DOMException with " + - "NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "createElementNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that createAttributeNS throws DOMException with NAMESPACE_ERR code.", + method = "createElementNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateAttributeNS6() throws Throwable { Document doc; Document newDoc; @@ -309,16 +287,12 @@ public final class DocumentCreateAttributeNS extends DOMTestCase { assertTrue("documentcreateattributeNS06", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that createAttributeNS throws DOMException with " + - "NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "createAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that createAttributeNS throws DOMException with NAMESPACE_ERR code.", + method = "createAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateAttributeNS7() throws Throwable { Document doc; diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentCreateElementNS.java b/xml/src/test/java/tests/org/w3c/dom/DocumentCreateElementNS.java index e53beb3..85f2fff 100644 --- a/xml/src/test/java/tests/org/w3c/dom/DocumentCreateElementNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentCreateElementNS.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Document; @@ -58,15 +58,12 @@ public final class DocumentCreateElementNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive functionality.", - targets = { - @TestTarget( - methodName = "createElementNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive functionality.", + method = "createElementNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateElementNS1() throws Throwable { Document doc; Element element; @@ -91,16 +88,12 @@ public final class DocumentCreateElementNS extends DOMTestCase { assertEquals("documentcreateelementNS01_prefix", "XML", prefix); assertEquals("documentcreateelementNS01_tagName", "XML:XML", tagName); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that createElementNS throws DOMException with " + - "INVALID_CHARACTER_ERR code.", - targets = { - @TestTarget( - methodName = "createElementNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that createElementNS throws DOMException with INVALID_CHARACTER_ERR code.", + method = "createElementNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateElementNS2() throws Throwable { Document doc; @@ -119,16 +112,12 @@ public final class DocumentCreateElementNS extends DOMTestCase { assertTrue("documentcreateelementNS02", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that createElementNS throws DOMException with " + - "NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "createElementNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that createElementNS throws DOMException with NAMESPACE_ERR code.", + method = "createElementNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateElementNS5() throws Throwable { Document doc; @@ -147,16 +136,12 @@ public final class DocumentCreateElementNS extends DOMTestCase { assertTrue("documentcreateelementNS05", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that createElementNS throws DOMException with " + - "NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "createElementNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that createElementNS throws DOMException with NAMESPACE_ERR code.", + method = "createElementNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testCreateElementNS6() throws Throwable { Document doc; Document newDoc; diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentGetElementsByTagnameNS.java b/xml/src/test/java/tests/org/w3c/dom/DocumentGetElementsByTagnameNS.java index 3a7dfa1..390bf11 100644 --- a/xml/src/test/java/tests/org/w3c/dom/DocumentGetElementsByTagnameNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentGetElementsByTagnameNS.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Document; @@ -61,15 +61,12 @@ public final class DocumentGetElementsByTagnameNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies '*' as parameters.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies '*' as parameters.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS1() throws Throwable { Document doc; Document newDoc; @@ -86,15 +83,12 @@ public final class DocumentGetElementsByTagnameNS extends DOMTestCase { assertEquals("documentgetelementsbytagnameNS01", 1, childList .getLength()); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies '*' as the first parameter.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies '*' as the first parameter.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS2() throws Throwable { Document doc; Element docElem; @@ -109,15 +103,12 @@ public final class DocumentGetElementsByTagnameNS extends DOMTestCase { assertEquals("documentgetelementsbytagnameNS02", 6, childList .getLength()); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies wrong namespaceURI as a parameter.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies wrong namespaceURI as a parameter.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS3() throws Throwable { Document doc; NodeList childList; @@ -126,15 +117,12 @@ public final class DocumentGetElementsByTagnameNS extends DOMTestCase { assertEquals("documentgetelementsbytagnameNS03", 0, childList .getLength()); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive functionality.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive functionality.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS4() throws Throwable { Document doc; NodeList childList; @@ -145,15 +133,12 @@ public final class DocumentGetElementsByTagnameNS extends DOMTestCase { assertEquals("documentgetelementsbytagnameNS04", 0, childList .getLength()); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive functionality.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive functionality.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS5() throws Throwable { Document doc; NodeList childList; diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentGeteEementById.java b/xml/src/test/java/tests/org/w3c/dom/DocumentGeteEementById.java index 972d2ba..7c82ac7 100644 --- a/xml/src/test/java/tests/org/w3c/dom/DocumentGeteEementById.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentGeteEementById.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Document; @@ -54,15 +54,12 @@ public final class DocumentGeteEementById extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify getElementById method for existent element.", - targets = { - @TestTarget( - methodName = "getElementById", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify getElementById method for existent element.", + method = "getElementById", + args = {java.lang.String.class} + ) public void testGetElementById() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentImportNode.java b/xml/src/test/java/tests/org/w3c/dom/DocumentImportNode.java index 2af6d8e..426a0ad 100644 --- a/xml/src/test/java/tests/org/w3c/dom/DocumentImportNode.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentImportNode.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Document; @@ -90,15 +90,12 @@ public final class DocumentImportNode extends DOMTestCase { // assertEquals("documentimportnode01_nodeType", 2, nodeType); // assertEquals("documentimportnode01_nodeValue", "Yes", nodeValue); // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException exception.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException exception.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode2() throws Throwable { Document doc; Document docImported; @@ -181,15 +178,12 @@ public final class DocumentImportNode extends DOMTestCase { // assertEquals("documentimportnode04_nodeType", 2, nodeType); // assertEquals("documentimportnode04_nodeValue", "defaultVal", nodeValue); // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException exception.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException exception.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode5() throws Throwable { Document doc; Document docImported; @@ -213,16 +207,12 @@ public final class DocumentImportNode extends DOMTestCase { assertEquals("documentimportnode05_namespaceURI", "http://www.w3.org/DOM/Test", namespaceURI); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that importNode method throws DOMException with " + - "NOT_SUPPORTED_ERR code.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that importNode method throws DOMException with NOT_SUPPORTED_ERR code.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode6() throws Throwable { Document doc; @@ -238,16 +228,12 @@ public final class DocumentImportNode extends DOMTestCase { assertTrue("throw_NOT_SUPPORTED_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that importNode method throws DOMException with " + - "NOT_SUPPORTED_ERR code.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that importNode method throws DOMException with NOT_SUPPORTED_ERR code.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode7() throws Throwable { Document doc; @@ -265,16 +251,12 @@ public final class DocumentImportNode extends DOMTestCase { assertTrue("throw_NOT_SUPPORTED_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that importNode method throws DOMException with " + - "NOT_SUPPORTED_ERR code.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that importNode method throws DOMException with NOT_SUPPORTED_ERR code.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode8() throws Throwable { Document doc; @@ -296,15 +278,12 @@ public final class DocumentImportNode extends DOMTestCase { assertTrue("throw_NOT_SUPPORTED_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException exception.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException exception.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode9() throws Throwable { Document doc; DocumentFragment docFragment; @@ -322,16 +301,12 @@ public final class DocumentImportNode extends DOMTestCase { success = importedDocFrag.hasChildNodes(); assertFalse("documentimportnode09", success); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive functionality; " + - "doesn't verify DOMException exceptions.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive functionality; doesn't verify DOMException exceptions.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode10() throws Throwable { Document doc; DocumentFragment docFragment; @@ -349,15 +324,12 @@ public final class DocumentImportNode extends DOMTestCase { success = importedDocFrag.hasChildNodes(); assertTrue("documentimportnode10", success); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException exception.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException exception.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode11() throws Throwable { Document doc; Element docElement; @@ -375,15 +347,12 @@ public final class DocumentImportNode extends DOMTestCase { assertEquals("documentimportnode11_NodeName", nodeNameImported, nodeNameOrig); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException exception.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException exception.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode12() throws Throwable { Document doc; NodeList childList; @@ -403,15 +372,12 @@ public final class DocumentImportNode extends DOMTestCase { importedLen = (int) importedChildren.getLength(); assertEquals("documentimportnode12", importedLen, addressElemLen); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException exception.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException exception.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode13() throws Throwable { Document doc; NodeList childList; @@ -455,15 +421,12 @@ public final class DocumentImportNode extends DOMTestCase { // "http://www.w3.org/2000/xmlns/", "emp"); // assertEquals("explicitAttrImported", "http://www.nist.gov", attrValue); // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies import of TEXT_NODE.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies import of TEXT_NODE.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode15() throws Throwable { Document doc; @@ -479,15 +442,12 @@ public final class DocumentImportNode extends DOMTestCase { assertEquals("documentimportnode15", "Document.importNode test for a TEXT_NODE", nodeValue); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies import of COMMENT_NODE", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies import of COMMENT_NODE", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode17() throws Throwable { Document doc; @@ -503,15 +463,12 @@ public final class DocumentImportNode extends DOMTestCase { assertEquals("documentimportnode17", "Document.importNode test for a COMMENT_NODE", nodeValue); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException exception.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException exception.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode18() throws Throwable { Document doc; diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentTypeInternalSubset.java b/xml/src/test/java/tests/org/w3c/dom/DocumentTypeInternalSubset.java index 1c42b2f..9e79788 100644 --- a/xml/src/test/java/tests/org/w3c/dom/DocumentTypeInternalSubset.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentTypeInternalSubset.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.DocumentType; @@ -54,15 +54,12 @@ public final class DocumentTypeInternalSubset extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't check positive case.", - targets = { - @TestTarget( - methodName = "getInternalSubset", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't check positive case.", + method = "getInternalSubset", + args = {} + ) public void testGetInternalSubset() throws Throwable { Document doc; DocumentType docType; diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentTypePublicId.java b/xml/src/test/java/tests/org/w3c/dom/DocumentTypePublicId.java index 1ffb424..26e9a5f 100644 --- a/xml/src/test/java/tests/org/w3c/dom/DocumentTypePublicId.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentTypePublicId.java @@ -22,9 +22,9 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Document; @@ -73,15 +73,12 @@ public final class DocumentTypePublicId extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getPublicId", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getPublicId", + args = {} + ) public void testGetPublicId() throws Throwable { Document doc; DocumentType docType; diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentTypeSystemId.java b/xml/src/test/java/tests/org/w3c/dom/DocumentTypeSystemId.java index 10be288..fcad024 100644 --- a/xml/src/test/java/tests/org/w3c/dom/DocumentTypeSystemId.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentTypeSystemId.java @@ -22,9 +22,9 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.DocumentType; @@ -70,15 +70,12 @@ public final class DocumentTypeSystemId extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getSystemId", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getSystemId", + args = {} + ) public void testGetSystemId() throws Throwable { Document doc; DocumentType docType; diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNodeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNodeNS.java index cb3b395..7760ba8 100644 --- a/xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNodeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNodeNS.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Element; @@ -53,15 +53,12 @@ public final class ElementGetAttributeNodeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getAttributeNodeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getAttributeNodeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetAttributeNodeNS1() throws Throwable { Document doc; Element element; @@ -99,15 +96,12 @@ public final class ElementGetAttributeNodeNS extends DOMTestCase { assertEquals("elementgetattributenodens01_attrNs", "http://www.w3.org/DOM/Level2", attrNS); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getAttributeNodeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getAttributeNodeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetAttributeNodeNS2() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementGetElementsByTagNameNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementGetElementsByTagNameNS.java index 1bd9fb6..f03007a 100644 --- a/xml/src/test/java/tests/org/w3c/dom/ElementGetElementsByTagNameNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementGetElementsByTagNameNS.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Element; @@ -53,15 +53,12 @@ public final class ElementGetElementsByTagNameNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS1() throws Throwable { Document doc; Element element; @@ -72,15 +69,12 @@ public final class ElementGetElementsByTagNameNS extends DOMTestCase { assertEquals("elementgetelementsbytagnamens02", 0, elementList .getLength()); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS4() throws Throwable { Document doc; Element element; @@ -108,15 +102,12 @@ public final class ElementGetElementsByTagNameNS extends DOMTestCase { assertEquals("elementgetelementsbytagnamens04_2", 3, elementList .getLength()); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS5() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementHasAttribute.java b/xml/src/test/java/tests/org/w3c/dom/ElementHasAttribute.java index 0be1a9a..711a1ab 100644 --- a/xml/src/test/java/tests/org/w3c/dom/ElementHasAttribute.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementHasAttribute.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Element; @@ -51,16 +51,12 @@ public final class ElementHasAttribute extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies hasAttribute method with empty string " + - "as a parameter.", - targets = { - @TestTarget( - methodName = "hasAttribute", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies hasAttribute method with empty string as a parameter.", + method = "hasAttribute", + args = {java.lang.String.class} + ) public void testHasAttribute1() throws Throwable { Document doc; Element element; @@ -84,15 +80,12 @@ public final class ElementHasAttribute extends DOMTestCase { // state = element.hasAttribute("defaultAttr"); // assertTrue("elementhasattribute02", state); // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive functionality.", - targets = { - @TestTarget( - methodName = "hasAttribute", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive functionality.", + method = "hasAttribute", + args = {java.lang.String.class} + ) public void testHasAttribute3() throws Throwable { Document doc; Element element; @@ -108,15 +101,12 @@ public final class ElementHasAttribute extends DOMTestCase { state = element.hasAttribute("domestic"); assertTrue("elementhasattribute03_True", state); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive functionality.", - targets = { - @TestTarget( - methodName = "hasAttribute", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive functionality.", + method = "hasAttribute", + args = {java.lang.String.class} + ) public void testHasAttribute4() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementHasAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementHasAttributeNS.java index 15d7cff..e0c9fd9 100644 --- a/xml/src/test/java/tests/org/w3c/dom/ElementHasAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementHasAttributeNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Element; @@ -77,15 +77,12 @@ public final class ElementHasAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "hasAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "hasAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void _testHasAttributeNS1() throws Throwable { Document doc; Element element; @@ -98,15 +95,12 @@ public final class ElementHasAttributeNS extends DOMTestCase { .hasAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns"); assertTrue("elementhasattributens01", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "hasAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "hasAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testHasAttributeNS2() throws Throwable { Document doc; Element element; @@ -120,15 +114,12 @@ public final class ElementHasAttributeNS extends DOMTestCase { state = element.hasAttributeNS("http://www.w3.org/DOM", "domestic"); assertTrue("hasDomesticAttr", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "hasAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "hasAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testHasAttributeNS3() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementRemoveAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementRemoveAttributeNS.java index 5c25b2a..72c56e9 100644 --- a/xml/src/test/java/tests/org/w3c/dom/ElementRemoveAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementRemoveAttributeNS.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Element; @@ -53,15 +53,12 @@ public final class ElementRemoveAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "removeAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "removeAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testRemoveAttributeNS() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNS.java index ea11d9d..babd6f1 100644 --- a/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNS.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.ArrayList; @@ -58,15 +58,12 @@ public final class ElementSetAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "setAttributeNS", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testSetAttributeNS1() throws Throwable { Document doc; Element element; @@ -84,15 +81,12 @@ public final class ElementSetAttributeNS extends DOMTestCase { assertEquals("elementsetattributens01_attrName", "attr", attrName); assertEquals("elementsetattributens01_attrValue", "value", attrValue); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "setAttributeNS", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testSetAttributeNS2() throws Throwable { Document doc; Element element; @@ -114,15 +108,12 @@ public final class ElementSetAttributeNS extends DOMTestCase { assertEquals("elementsetattributens02_attrValue", "Silver Street", attrValue); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "setAttributeNS", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testSetAttributeNS3() throws Throwable { Document doc; Element element; @@ -146,15 +137,12 @@ public final class ElementSetAttributeNS extends DOMTestCase { attrName); assertEquals("elementsetattributens03_attrValue", "default1", attrValue); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with INVALID_CHARACTER_ERR.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with INVALID_CHARACTER_ERR.", + method = "setAttributeNS", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testSetAttributeNS4() throws Throwable { Document doc; Element element; @@ -188,15 +176,12 @@ public final class ElementSetAttributeNS extends DOMTestCase { } } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with NAMESPACE_ERR code.", + method = "setAttributeNS", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testSetAttributeNS5() throws Throwable { Document doc; Element element; @@ -216,15 +201,12 @@ public final class ElementSetAttributeNS extends DOMTestCase { assertTrue("elementsetattributens05", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with NAMESPACE_ERR code.", + method = "setAttributeNS", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testSetAttributeNS8() throws Throwable { Document doc; Element element; @@ -254,15 +236,12 @@ public final class ElementSetAttributeNS extends DOMTestCase { assertTrue("elementsetattributens08_Err2", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with NAMESPACE_ERR code.", + method = "setAttributeNS", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testSetAttributeNSURINull() throws Throwable { String namespaceURI = null; diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNodeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNodeNS.java index 0a253da..2a115e0 100644 --- a/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNodeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNodeNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Element; @@ -79,15 +79,12 @@ public final class ElementSetAttributeNodeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "setAttributeNodeNS", - methodArgs = {org.w3c.dom.Attr.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "setAttributeNodeNS", + args = {org.w3c.dom.Attr.class} + ) public void testSetAttributeNodeNS1() throws Throwable { Document doc; Element element; @@ -121,15 +118,12 @@ public final class ElementSetAttributeNodeNS extends DOMTestCase { length = (int) attributes.getLength(); assertEquals("length", 1, length); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "setAttributeNodeNS", - methodArgs = {org.w3c.dom.Attr.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "setAttributeNodeNS", + args = {org.w3c.dom.Attr.class} + ) public void testSetAttributeNodeNS2() throws Throwable { Document doc; Element element; @@ -155,15 +149,12 @@ public final class ElementSetAttributeNodeNS extends DOMTestCase { assertEquals("elementsetattributenodens02_attrName", "street", attrName); assertEquals("elementsetattributenodens02_attrValue", "Yes", attrValue); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.", - targets = { - @TestTarget( - methodName = "setAttributeNodeNS", - methodArgs = {org.w3c.dom.Attr.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.", + method = "setAttributeNodeNS", + args = {org.w3c.dom.Attr.class} + ) public void testSetAttributeNodeNS3() throws Throwable { Document doc; Element element1; @@ -190,15 +181,12 @@ public final class ElementSetAttributeNodeNS extends DOMTestCase { assertTrue("elementsetattributenodens03", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.", - targets = { - @TestTarget( - methodName = "setAttributeNodeNS", - methodArgs = {org.w3c.dom.Attr.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.", + method = "setAttributeNodeNS", + args = {org.w3c.dom.Attr.class} + ) public void testSetAttributeNodeNS4() throws Throwable { Document doc; Element element1; @@ -221,15 +209,12 @@ public final class ElementSetAttributeNodeNS extends DOMTestCase { assertTrue("elementsetattributenodens04", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with WRONG_DOCUMENT_ERR code.", - targets = { - @TestTarget( - methodName = "setAttributeNodeNS", - methodArgs = {org.w3c.dom.Attr.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with WRONG_DOCUMENT_ERR code.", + method = "setAttributeNodeNS", + args = {org.w3c.dom.Attr.class} + ) public void testSetAttributeNodeNS5() throws Throwable { Document doc; Document docAlt; @@ -252,15 +237,12 @@ public final class ElementSetAttributeNodeNS extends DOMTestCase { assertTrue("throw_WRONG_DOCUMENT_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with NO_MODIFICATION_ALLOWED_ERR code.", - targets = { - @TestTarget( - methodName = "setAttributeNodeNS", - methodArgs = {org.w3c.dom.Attr.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with NO_MODIFICATION_ALLOWED_ERR code.", + method = "setAttributeNodeNS", + args = {org.w3c.dom.Attr.class} + ) public void _testSetAttributeNodeNS6() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/tests/org/w3c/dom/GetAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/GetAttributeNS.java index 6a3ee11..ae5936c 100644 --- a/xml/src/test/java/tests/org/w3c/dom/GetAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/GetAttributeNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Element; @@ -93,15 +93,12 @@ public final class GetAttributeNS extends DOMTestCase { // attrValue = testAddr.getAttributeNS(namespaceURI, localName); // assertEquals("attrValue", "DISTRICT", attrValue); // } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetAttributeNS2() throws Throwable { String namespaceURI = "http://www.nist.gov"; String localName = "district"; @@ -123,15 +120,12 @@ public final class GetAttributeNS extends DOMTestCase { attrValue = testAddr.getAttributeNS(namespaceURI, localName); assertEquals("throw_Equals", "", attrValue); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetAttributeNS3() throws Throwable { String namespaceURI = "http://www.nist.gov"; String localName = "domestic"; @@ -147,15 +141,12 @@ public final class GetAttributeNS extends DOMTestCase { attrValue = testAddr.getAttributeNS(namespaceURI, localName); assertEquals("throw_Equals", "", attrValue); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetAttributeNS4() throws Throwable { String namespaceURI = "http://www.nist.gov"; String localName = "blank"; @@ -175,15 +166,12 @@ public final class GetAttributeNS extends DOMTestCase { attrValue = testAddr.getAttributeNS(namespaceURI, localName); assertEquals("throw_Equals", "NewValue", attrValue); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetAttributeNS5() throws Throwable { Document doc; NodeList elementList; diff --git a/xml/src/test/java/tests/org/w3c/dom/GetAttributeNodeNS.java b/xml/src/test/java/tests/org/w3c/dom/GetAttributeNodeNS.java index 7b2488a..7c72fe5 100644 --- a/xml/src/test/java/tests/org/w3c/dom/GetAttributeNodeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/GetAttributeNodeNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Element; @@ -77,15 +77,12 @@ public final class GetAttributeNodeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getAttributeNodeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getAttributeNodeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetAttributeNodeNS1() throws Throwable { String namespaceURI = "http://www.nist.gov"; String localName = "invalidlocalname"; @@ -100,15 +97,12 @@ public final class GetAttributeNodeNS extends DOMTestCase { attribute = testAddr.getAttributeNodeNS(namespaceURI, localName); assertNull("throw_Null", attribute); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getAttributeNodeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getAttributeNodeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetAttributeNodeNS2() throws Throwable { Document doc; NodeList elementList; diff --git a/xml/src/test/java/tests/org/w3c/dom/GetElementById.java b/xml/src/test/java/tests/org/w3c/dom/GetElementById.java index 9f35447..073df2f 100644 --- a/xml/src/test/java/tests/org/w3c/dom/GetElementById.java +++ b/xml/src/test/java/tests/org/w3c/dom/GetElementById.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Document; @@ -86,15 +86,12 @@ public final class GetElementById extends DOMTestCase { // tagname = element.getTagName(); // assertEquals("throw_Equals", "emp:address", tagname); // } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify getElementById method for existent element.", - targets = { - @TestTarget( - methodName = "getElementById", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify getElementById method for existent element.", + method = "getElementById", + args = {java.lang.String.class} + ) public void testGetElementById2() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/tests/org/w3c/dom/GetElementsByTagNameNS.java b/xml/src/test/java/tests/org/w3c/dom/GetElementsByTagNameNS.java index 7c83175..d5fa0bf 100644 --- a/xml/src/test/java/tests/org/w3c/dom/GetElementsByTagNameNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/GetElementsByTagNameNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.ArrayList; @@ -72,15 +72,12 @@ public final class GetElementsByTagNameNS extends DOMTestCase { builder = null; super.tearDown(); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getElementsByTagNameNS method with * as parameters.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getElementsByTagNameNS method with * as parameters.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS1() throws Throwable { String namespaceURI = "*"; String localName = "*"; @@ -92,16 +89,12 @@ public final class GetElementsByTagNameNS extends DOMTestCase { assertEquals("throw_Size", 36, newList.getLength()); // END android-changed } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getElementsByTagNameNS with '*' " + - "as the first parameter.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getElementsByTagNameNS with '*' as the first parameter.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS2() throws Throwable { Document doc; NodeList newList; @@ -117,16 +110,12 @@ public final class GetElementsByTagNameNS extends DOMTestCase { lname = newElement.getLocalName(); assertEquals("lname", "employee", lname); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getElementsByTagNameNS with '*' " + - "as the second parameter.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getElementsByTagNameNS with '*' as the second parameter.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS3() throws Throwable { Document doc; NodeList elementList; @@ -159,16 +148,12 @@ public final class GetElementsByTagNameNS extends DOMTestCase { } assertEquals("nodeNames", expectedResult, result); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getElementsByTagNameNS with '*' " + - "as the first parameter.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getElementsByTagNameNS with '*' as the first parameter.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS4() throws Throwable { Document doc; NodeList elementList; @@ -192,15 +177,12 @@ public final class GetElementsByTagNameNS extends DOMTestCase { } assertEquals("nodeNames", expectedResult, result); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies negative case of getElementsByTagNameNS method.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies negative case of getElementsByTagNameNS method.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS5() throws Throwable { String namespaceURI = "http://www.nist.gov"; String localName = "nomatch"; @@ -210,15 +192,12 @@ public final class GetElementsByTagNameNS extends DOMTestCase { elementList = doc.getElementsByTagNameNS(namespaceURI, localName); assertEquals("throw_Size", 0, elementList.getLength()); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies negative case of getElementsByTagNameNS method.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies negative case of getElementsByTagNameNS method.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS6() throws Throwable { Document doc; NodeList elementList; @@ -227,15 +206,12 @@ public final class GetElementsByTagNameNS extends DOMTestCase { "address"); assertEquals("matchSize", 0, elementList.getLength()); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive case of getElementsByTagNameNS method.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive case of getElementsByTagNameNS method.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS7() throws Throwable { Document doc; NodeList elementList; @@ -244,16 +220,12 @@ public final class GetElementsByTagNameNS extends DOMTestCase { "address"); assertEquals("addresses", 3, elementList.getLength()); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getElementsByTagNameNS method with '*' " + - "as parameters; positive case.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getElementsByTagNameNS method with '*' as parameters; positive case.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS8() throws Throwable { Document doc; Element docElem; @@ -263,16 +235,12 @@ public final class GetElementsByTagNameNS extends DOMTestCase { newList = docElem.getElementsByTagNameNS("*", "*"); assertEquals("listSize", 36, newList.getLength()); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getElementsByTagNameNS method with '*' " + - "as the first parameter.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getElementsByTagNameNS method with '*' as the first parameter.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS9() throws Throwable { Document doc; NodeList newList; @@ -290,16 +258,12 @@ public final class GetElementsByTagNameNS extends DOMTestCase { lname = newElement.getLocalName(); assertEquals("lname", "employee", lname); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getElementsByTagNameNS method with '*' as the second " + - "parameter.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getElementsByTagNameNS method with '*' as the second parameter.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS10() throws Throwable { Document doc; Element docElem; @@ -335,16 +299,12 @@ public final class GetElementsByTagNameNS extends DOMTestCase { } assertEquals("nodeNames", expectedResult, result); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies getElementsByTagNameNS method with '*' as the first " + - "parameter.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies getElementsByTagNameNS method with '*' as the first parameter.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS11() throws Throwable { Document doc; Element docElem; @@ -370,15 +330,12 @@ public final class GetElementsByTagNameNS extends DOMTestCase { } assertEquals("nodeNames", expectedResult, result); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies negative case for getElementsByTagNameNS method.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies negative case for getElementsByTagNameNS method.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS12() throws Throwable { Document doc; Element docElem; @@ -389,15 +346,12 @@ public final class GetElementsByTagNameNS extends DOMTestCase { "nomatch"); assertEquals("size", 0, elementList.getLength()); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies negative case for getElementsByTagNameNS method.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies negative case for getElementsByTagNameNS method.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS13() throws Throwable { Document doc; Element docElem; @@ -408,15 +362,12 @@ public final class GetElementsByTagNameNS extends DOMTestCase { "address"); assertEquals("matchSize", 0, elementList.getLength()); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive case for getElementsByTagNameNS method.", - targets = { - @TestTarget( - methodName = "getElementsByTagNameNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive case for getElementsByTagNameNS method.", + method = "getElementsByTagNameNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetElementsByTagNameNS14() throws Throwable { Document doc; Element docElem; diff --git a/xml/src/test/java/tests/org/w3c/dom/GetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/GetNamedItemNS.java index a06a5e0..270fe04 100644 --- a/xml/src/test/java/tests/org/w3c/dom/GetNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/GetNamedItemNS.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.NamedNodeMap; @@ -57,15 +57,12 @@ public final class GetNamedItemNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getNamedItem", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getNamedItem", + args = {java.lang.String.class} + ) public void testGetNamedItemNS1() throws Throwable { Document doc; NodeList elementList; @@ -82,15 +79,12 @@ public final class GetNamedItemNS extends DOMTestCase { attrName = domesticAttr.getNodeName(); assertEquals("attrName", "dmstc:domestic", attrName); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getNamedItemNS", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetNamedItemNS2() throws Throwable { String namespaceURI = "http://www.usa.com"; String localName = "domest"; diff --git a/xml/src/test/java/tests/org/w3c/dom/HCNamedNodeMapInvalidType.java b/xml/src/test/java/tests/org/w3c/dom/HCNamedNodeMapInvalidType.java index 675140c..d968bc4 100644 --- a/xml/src/test/java/tests/org/w3c/dom/HCNamedNodeMapInvalidType.java +++ b/xml/src/test/java/tests/org/w3c/dom/HCNamedNodeMapInvalidType.java @@ -18,9 +18,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.NamedNodeMap; @@ -72,16 +72,12 @@ public final class HCNamedNodeMapInvalidType extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that setNamedItem method throws DOMException with " + - "HIERARCHY_REQUEST_ERR code.", - targets = { - @TestTarget( - methodName = "setNamedItem", - methodArgs = {org.w3c.dom.Node.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that setNamedItem method throws DOMException with HIERARCHY_REQUEST_ERR code.", + method = "setNamedItem", + args = {org.w3c.dom.Node.class} + ) public void testNamedNodeMapInvalidType() throws Throwable { Document doc; NamedNodeMap attributes; diff --git a/xml/src/test/java/tests/org/w3c/dom/HCNodeDocumentFragmentNormalize.java b/xml/src/test/java/tests/org/w3c/dom/HCNodeDocumentFragmentNormalize.java index 89be8c6..53317b3 100644 --- a/xml/src/test/java/tests/org/w3c/dom/HCNodeDocumentFragmentNormalize.java +++ b/xml/src/test/java/tests/org/w3c/dom/HCNodeDocumentFragmentNormalize.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Node; @@ -52,20 +52,19 @@ public final class HCNodeDocumentFragmentNormalize extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies positive functionality of getNodeValue method, " + - "and that getNextSibling method returns null.", - targets = { - @TestTarget( - methodName = "getNodeValue", - methodArgs = {} + @TestTargets({ + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies positive functionality of getNodeValue method, and that getNextSibling method returns null.", + method = "getNodeValue", + args = {} ), - @TestTarget( - methodName = "getNextSibling", - methodArgs = {} + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies positive functionality of getNodeValue method, and that getNextSibling method returns null.", + method = "getNextSibling", + args = {} ) - }) public void testNodeDocumentFragmentNormalize1() throws Throwable { Document doc; @@ -87,15 +86,12 @@ public final class HCNodeDocumentFragmentNormalize extends DOMTestCase { retval = txtNode.getNextSibling(); assertNull("singleChild", retval); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that getFirstChild method returns null.", - targets = { - @TestTarget( - methodName = "getFirstChild", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that getFirstChild method returns null.", + method = "getFirstChild", + args = {} + ) public void testNodeDocumentFragmentNormalize2() throws Throwable { Document doc; DocumentFragment docFragment; diff --git a/xml/src/test/java/tests/org/w3c/dom/HCNotationsRemoveNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/HCNotationsRemoveNamedItemNS.java index 43c1bdc..3eab5fc 100644 --- a/xml/src/test/java/tests/org/w3c/dom/HCNotationsRemoveNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/HCNotationsRemoveNamedItemNS.java @@ -18,9 +18,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.NamedNodeMap; @@ -70,15 +70,12 @@ public final class HCNotationsRemoveNamedItemNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that removeNamedItemNS method throws DOMException.", - targets = { - @TestTarget( - methodName = "removeNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that removeNamedItemNS method throws DOMException.", + method = "removeNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testRemoveNamedItemNS() throws Throwable { Document doc; NamedNodeMap notations; diff --git a/xml/src/test/java/tests/org/w3c/dom/HCNotationsSetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/HCNotationsSetNamedItemNS.java index 6c72d9d..d5daee4 100644 --- a/xml/src/test/java/tests/org/w3c/dom/HCNotationsSetNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/HCNotationsSetNamedItemNS.java @@ -18,9 +18,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.NamedNodeMap; @@ -71,15 +71,12 @@ public final class HCNotationsSetNamedItemNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that setNamedItemNS throws DOMException.", - targets = { - @TestTarget( - methodName = "setNamedItemNS", - methodArgs = {org.w3c.dom.Node.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that setNamedItemNS throws DOMException.", + method = "setNamedItemNS", + args = {org.w3c.dom.Node.class} + ) public void testNotationsSetNamedItemNS() throws Throwable { Document doc; NamedNodeMap notations; diff --git a/xml/src/test/java/tests/org/w3c/dom/HasAttribute.java b/xml/src/test/java/tests/org/w3c/dom/HasAttribute.java index 1f51c70..89eef88 100644 --- a/xml/src/test/java/tests/org/w3c/dom/HasAttribute.java +++ b/xml/src/test/java/tests/org/w3c/dom/HasAttribute.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Element; @@ -52,15 +52,12 @@ public final class HasAttribute extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that hasAttribute method returns false.", - targets = { - @TestTarget( - methodName = "hasAttribute", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that hasAttribute method returns false.", + method = "hasAttribute", + args = {java.lang.String.class} + ) public void testHasAttribute1() throws Throwable { Document doc; NodeList elementList; @@ -85,15 +82,12 @@ public final class HasAttribute extends DOMTestCase { // state = testNode.hasAttribute("street"); // assertTrue("throw_True", state); // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that hasAttribute method returns false.", - targets = { - @TestTarget( - methodName = "hasAttribute", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that hasAttribute method returns false.", + method = "hasAttribute", + args = {java.lang.String.class} + ) public void testHasAttribute3() throws Throwable { Document doc; NodeList elementList; @@ -105,15 +99,12 @@ public final class HasAttribute extends DOMTestCase { state = testNode.hasAttribute("nomatch"); assertFalse("throw_False", state); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that hasAttribute method returns true.", - targets = { - @TestTarget( - methodName = "hasAttribute", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that hasAttribute method returns true.", + method = "hasAttribute", + args = {java.lang.String.class} + ) public void testHasAttribute4() throws Throwable { Document doc; NodeList elementList; diff --git a/xml/src/test/java/tests/org/w3c/dom/HasAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/HasAttributeNS.java index 614818b..cf1b90e 100644 --- a/xml/src/test/java/tests/org/w3c/dom/HasAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/HasAttributeNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Element; @@ -76,15 +76,12 @@ public final class HasAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "hasAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "hasAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testHasAttributeNS1() throws Throwable { String localName = "nomatch"; String namespaceURI = "http://www.usa.com"; @@ -98,15 +95,12 @@ public final class HasAttributeNS extends DOMTestCase { state = testNode.hasAttributeNS(namespaceURI, localName); assertFalse("throw_False", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "hasAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "hasAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testHasAttributeNS2() throws Throwable { String localName = "domestic"; String namespaceURI = "http://www.nomatch.com"; @@ -120,15 +114,12 @@ public final class HasAttributeNS extends DOMTestCase { state = testNode.hasAttributeNS(namespaceURI, localName); assertFalse("throw_False", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "hasAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "hasAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testHasAttributeNS3() throws Throwable { String localName = "blank"; String namespaceURI = "http://www.nist.gov"; @@ -159,15 +150,12 @@ public final class HasAttributeNS extends DOMTestCase { // state = testNode.hasAttributeNS(namespaceURI, localName); // assertTrue("hasAttribute", state); // } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "hasAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "hasAttributeNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testHasAttributeNS5() throws Throwable { String localName = "domestic"; String namespaceURI = "http://www.usa.com"; diff --git a/xml/src/test/java/tests/org/w3c/dom/HasAttributes.java b/xml/src/test/java/tests/org/w3c/dom/HasAttributes.java index af0fa03..5d3954d 100644 --- a/xml/src/test/java/tests/org/w3c/dom/HasAttributes.java +++ b/xml/src/test/java/tests/org/w3c/dom/HasAttributes.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Node; @@ -73,15 +73,12 @@ public final class HasAttributes extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that hasAttributes method returns false value.", - targets = { - @TestTarget( - methodName = "hasAttributes", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that hasAttributes method returns false value.", + method = "hasAttributes", + args = {} + ) public void testHasAttributes1() throws Throwable { Document doc; NodeList addrList; @@ -93,15 +90,12 @@ public final class HasAttributes extends DOMTestCase { state = addrNode.hasAttributes(); assertFalse("throw_False", state); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that hasAttributes method returns true value.", - targets = { - @TestTarget( - methodName = "hasAttributes", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that hasAttributes method returns true value.", + method = "hasAttributes", + args = {} + ) public void testHasAttributes2() throws Throwable { Document doc; NodeList addrList; diff --git a/xml/src/test/java/tests/org/w3c/dom/ImportNode.java b/xml/src/test/java/tests/org/w3c/dom/ImportNode.java index 45ce6d6..de39392 100644 --- a/xml/src/test/java/tests/org/w3c/dom/ImportNode.java +++ b/xml/src/test/java/tests/org/w3c/dom/ImportNode.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.ArrayList; @@ -94,15 +94,12 @@ public final class ImportNode extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void _testImportNode1() throws Throwable { Document doc; Document aNewDoc; @@ -146,15 +143,12 @@ public final class ImportNode extends DOMTestCase { childValue = child.getNodeValue(); assertEquals("childValue", "importedText", childValue); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode2() throws Throwable { Document doc; Document aNewDoc; @@ -177,15 +171,12 @@ public final class ImportNode extends DOMTestCase { value = aNode.getNodeValue(); assertEquals("nodeValue", "this is CDATASection data", value); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode3() throws Throwable { Document doc; Document aNewDoc; @@ -208,15 +199,12 @@ public final class ImportNode extends DOMTestCase { value = aNode.getNodeValue(); assertEquals("nodeValue", "this is a comment", value); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode4() throws Throwable { Document doc; Document aNewDoc; @@ -238,15 +226,12 @@ public final class ImportNode extends DOMTestCase { childValue = child.getNodeValue(); assertEquals("descendant1", "descendant1", childValue); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode5() throws Throwable { Document doc; Document aNewDoc; @@ -274,15 +259,12 @@ public final class ImportNode extends DOMTestCase { name = aNode.getNodeName(); assertEquals("nodeName", "emp:address", name); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode6() throws Throwable { Document doc; Document aNewDoc; @@ -332,15 +314,12 @@ public final class ImportNode extends DOMTestCase { // lname = attr.getLocalName(); // assertEquals("lname", "defaultAttr", lname); // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode8() throws Throwable { Document doc; Document aNewDoc; @@ -399,15 +378,12 @@ public final class ImportNode extends DOMTestCase { // notationName = entity1.getNotationName(); // assertEquals("notationName", "notation2", notationName); // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode10() throws Throwable { Document doc; Document aNewDoc; @@ -517,15 +493,12 @@ public final class ImportNode extends DOMTestCase { // system = aNode.getSystemId(); // assertNull("notationSystemId", system); // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode14() throws Throwable { Document doc; Document aNewDoc; @@ -552,15 +525,12 @@ public final class ImportNode extends DOMTestCase { data = aNode.getData(); assertEquals("piData", "data1", data); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode15() throws Throwable { Document doc; Document aNewDoc; @@ -583,16 +553,12 @@ public final class ImportNode extends DOMTestCase { value = aNode.getNodeValue(); assertEquals("nodeValue", "this is text data", value); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that importNode method throws DOMException " + - "with NOT_SUPPORTED_ERR code.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that importNode method throws DOMException with NOT_SUPPORTED_ERR code.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode16() throws Throwable { Document doc; Document anotherDoc; @@ -612,16 +578,12 @@ public final class ImportNode extends DOMTestCase { assertTrue("throw_NOT_SUPPORTED_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that importNode method throws DOMException " + - "with NOT_SUPPORTED_ERR code.", - targets = { - @TestTarget( - methodName = "importNode", - methodArgs = {org.w3c.dom.Node.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that importNode method throws DOMException with NOT_SUPPORTED_ERR code.", + method = "importNode", + args = {org.w3c.dom.Node.class, boolean.class} + ) public void testImportNode17() throws Throwable { Document doc; Document anotherDoc; diff --git a/xml/src/test/java/tests/org/w3c/dom/InternalSubset.java b/xml/src/test/java/tests/org/w3c/dom/InternalSubset.java index d15cb37..f8f306c 100644 --- a/xml/src/test/java/tests/org/w3c/dom/InternalSubset.java +++ b/xml/src/test/java/tests/org/w3c/dom/InternalSubset.java @@ -22,9 +22,9 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.DocumentType; @@ -72,16 +72,12 @@ public final class InternalSubset extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify that getInternalSubset method returns " + - "the internal subset as a string.", - targets = { - @TestTarget( - methodName = "getInternalSubset", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify that getInternalSubset method returns the internal subset as a string.", + method = "getInternalSubset", + args = {} + ) public void testGetInternalSubset() throws Throwable { Document doc; DocumentType docType; diff --git a/xml/src/test/java/tests/org/w3c/dom/IsSupported.java b/xml/src/test/java/tests/org/w3c/dom/IsSupported.java index a8fba52..318a81d 100644 --- a/xml/src/test/java/tests/org/w3c/dom/IsSupported.java +++ b/xml/src/test/java/tests/org/w3c/dom/IsSupported.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.ArrayList; @@ -60,15 +60,12 @@ public final class IsSupported extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that isSupported method returns false.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that isSupported method returns false.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported1() throws Throwable { Document doc; Node rootNode; @@ -78,15 +75,12 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("XXX", "1.0"); assertFalse("throw_False", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that isSupported method returns false value.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that isSupported method returns false value.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported2() throws Throwable { Document doc; Node rootNode; @@ -96,15 +90,12 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("XML", "9.0"); assertFalse("throw_False", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that isSupported method returns true value.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that isSupported method returns true value.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported4() throws Throwable { Document doc; Node rootNode; @@ -114,15 +105,12 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("xml", "1.0"); assertTrue("throw_True", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that isSupported method returns true value.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that isSupported method returns true value.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported5() throws Throwable { Document doc; Node rootNode; @@ -132,15 +120,12 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("core", "2.0"); assertTrue("throw_True", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that isSupported method returns true value.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that isSupported method returns true value.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported6() throws Throwable { Document doc; Node rootNode; @@ -150,15 +135,12 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("xml", "2.0"); assertTrue("throw_True", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that isSupported method returns true value.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that isSupported method returns true value.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported7() throws Throwable { Document doc; Node rootNode; @@ -168,15 +150,12 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("XML", ""); assertTrue("throw_True", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that isSupported method returns true value.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that isSupported method returns true value.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported9() throws Throwable { Document doc; Node rootNode; @@ -186,15 +165,12 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("XML", "1.0"); assertTrue("throw_True", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that isSupported method returns true.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that isSupported method returns true.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported10() throws Throwable { Document doc; Node rootNode; @@ -204,15 +180,12 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("CORE", "2.0"); assertTrue("throw_True", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that isSupported method returns true.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that isSupported method returns true.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported11() throws Throwable { Document doc; Node rootNode; @@ -223,15 +196,12 @@ public final class IsSupported extends DOMTestCase { assertTrue("throw_True", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported12() throws Throwable { List<String> features = new ArrayList<String>(); features.add("Core"); @@ -267,16 +237,12 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported(featureElement, "2.0"); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that isSupported method returns correct value " + - "if it has empty string as a version parameter.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that isSupported method returns correct value if it has empty string as a version parameter.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported13() throws Throwable { Document doc; Node rootNode; @@ -286,16 +252,12 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("Core", ""); assertTrue("Core", state); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that isSupported method returns correct value " + - "if it has null as a version parameter.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {String.class, String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that isSupported method returns correct value if it has null as a version parameter.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported14() throws Throwable { Document doc; Node rootNode; diff --git a/xml/src/test/java/tests/org/w3c/dom/LocalName.java b/xml/src/test/java/tests/org/w3c/dom/LocalName.java index 9d001c0..3f1d9c3 100644 --- a/xml/src/test/java/tests/org/w3c/dom/LocalName.java +++ b/xml/src/test/java/tests/org/w3c/dom/LocalName.java @@ -1,8 +1,8 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Node; @@ -58,15 +58,12 @@ public final class LocalName extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive functionality.", - targets = { - @TestTarget( - methodName = "getLocalName", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive functionality.", + method = "getLocalName", + args = {} + ) public void testGetLocalName1() throws Throwable { Document doc; NodeList elementList; @@ -81,15 +78,12 @@ public final class LocalName extends DOMTestCase { localName = addrAttr.getLocalName(); assertEquals("localName", "domestic", localName); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that getLocalName method returns null.", - targets = { - @TestTarget( - methodName = "getLocalName", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that getLocalName method returns null.", + method = "getLocalName", + args = {} + ) public void testGetLocalName2() throws Throwable { Document doc; Node createdNode; @@ -99,15 +93,12 @@ public final class LocalName extends DOMTestCase { localName = createdNode.getLocalName(); assertNull("localNameNull", localName); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that getLocalName method returns null.", - targets = { - @TestTarget( - methodName = "getLocalName", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that getLocalName method returns null.", + method = "getLocalName", + args = {} + ) public void testGetLocalName3() throws Throwable { Document doc; NodeList elementList; @@ -121,15 +112,12 @@ public final class LocalName extends DOMTestCase { localName = textNode.getLocalName(); assertNull("textNodeLocalName", localName); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive functionality.", - targets = { - @TestTarget( - methodName = "getLocalName", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive functionality.", + method = "getLocalName", + args = {} + ) public void testGetLocalName4() throws Throwable { Document doc; NodeList elementList; diff --git a/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapGetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapGetNamedItemNS.java index f4338e3..e4ab1df 100644 --- a/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapGetNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapGetNamedItemNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.NamedNodeMap; @@ -103,15 +103,12 @@ public final class NamedNodeMapGetNamedItemNS extends DOMTestCase { // notation = (Notation) notations.getNamedItemNS(nullNS, "notation1"); // assertNotNull("notationNull", notation); // } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetNamedItemNS2() throws Throwable { Document doc; NamedNodeMap attributes; @@ -129,15 +126,12 @@ public final class NamedNodeMapGetNamedItemNS extends DOMTestCase { attrName = attribute.getNodeName(); assertEquals("namednodemapgetnameditemns02", "emp:domestic", attrName); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetNamedItemNS3() throws Throwable { Document doc; NamedNodeMap attributes; @@ -159,15 +153,12 @@ public final class NamedNodeMapGetNamedItemNS extends DOMTestCase { attrName = attribute.getNodeName(); assertEquals("namednodemapgetnameditemns03", "L2:att", attrName); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetNamedItemNS4() throws Throwable { Document doc; NamedNodeMap attributes; @@ -187,15 +178,12 @@ public final class NamedNodeMapGetNamedItemNS extends DOMTestCase { attrName = attribute.getNodeName(); assertEquals("namednodemapgetnameditemns04", "street", attrName); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "getNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "getNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testGetNamedItemNS5() throws Throwable { Document doc; NamedNodeMap attributes; diff --git a/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapRemoveNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapRemoveNamedItemNS.java index af7f061..16a6cda 100644 --- a/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapRemoveNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapRemoveNamedItemNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.NamedNodeMap; @@ -78,15 +78,12 @@ public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "removeNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "removeNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testRemoveNamedItemNS1() throws Throwable { Document doc; NamedNodeMap attributes; @@ -127,15 +124,12 @@ public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { // assertEquals("namednodemapremovenameditemns02_attrValue", "defaultVal", // attrValue); // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "removeNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "removeNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testRemoveNamedItemNS3() throws Throwable { Document doc; NamedNodeMap attributes; @@ -161,15 +155,12 @@ public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { nodeName = attribute.getNodeName(); assertEquals("namednodemapremovenameditemns02", "L2:att", nodeName); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "removeNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "removeNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void _testRemoveNamedItemNS4() throws Throwable { Document doc; NamedNodeMap attributes; @@ -237,16 +228,12 @@ public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { // } // } // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that removeNamedItemNS method throws DOMException " + - "with NOT_FOUND_ERR code.", - targets = { - @TestTarget( - methodName = "removeNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that removeNamedItemNS method throws DOMException with NOT_FOUND_ERR code.", + method = "removeNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testRemoveNamedItemNS6() throws Throwable { Document doc; NamedNodeMap attributes; @@ -269,16 +256,12 @@ public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { assertTrue("throw_NOT_FOUND_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that removeNamedItemNS method throws DOMException " + - "with NOT_FOUND_ERR code.", - targets = { - @TestTarget( - methodName = "removeNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that removeNamedItemNS method throws DOMException with NOT_FOUND_ERR code.", + method = "removeNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testRemoveNamedItemNS7() throws Throwable { Document doc; NamedNodeMap attributes; @@ -301,16 +284,12 @@ public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { assertTrue("throw_NOT_FOUND_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies that removeNamedItemNS method throws DOMException " + - "with NOT_FOUND_ERR code.", - targets = { - @TestTarget( - methodName = "removeNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies that removeNamedItemNS method throws DOMException with NOT_FOUND_ERR code.", + method = "removeNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testRemoveNamedItemNS8() throws Throwable { Document doc; NamedNodeMap attributes; @@ -334,15 +313,12 @@ public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { assertTrue("throw_NOT_FOUND_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "removeNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "removeNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testRemoveNamedItemNS9() throws Throwable { Document doc; NamedNodeMap attributes; diff --git a/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapSetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapSetNamedItemNS.java index 50c7022..e0ec0df 100644 --- a/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapSetNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapSetNamedItemNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.NamedNodeMap; @@ -86,15 +86,12 @@ public final class NamedNodeMapSetNamedItemNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "setNamedItemNS", - methodArgs = {org.w3c.dom.Node.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "setNamedItemNS", + args = {org.w3c.dom.Node.class} + ) public void testSetNamedItemNS1() throws Throwable { Document doc; NamedNodeMap attributes; @@ -116,15 +113,12 @@ public final class NamedNodeMapSetNamedItemNS extends DOMTestCase { attrName = attribute.getNodeName(); assertEquals("namednodemapsetnameditemns01", "streets", attrName); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "setNamedItemNS", - methodArgs = {org.w3c.dom.Node.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException.", + method = "setNamedItemNS", + args = {org.w3c.dom.Node.class} + ) public void testSetNamedItemNS2() throws Throwable { Document doc; NamedNodeMap attributes; @@ -144,16 +138,12 @@ public final class NamedNodeMapSetNamedItemNS extends DOMTestCase { attrName = attribute.getNodeName(); assertEquals("namednodemapsetnameditemns02", "L1:att", attrName); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that setNamedItemNS throws DOMException with " + - "WRONG_DOCUMENT_ERR code.", - targets = { - @TestTarget( - methodName = "setNamedItemNS", - methodArgs = {org.w3c.dom.Node.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that setNamedItemNS throws DOMException with WRONG_DOCUMENT_ERR code.", + method = "setNamedItemNS", + args = {org.w3c.dom.Node.class} + ) public void testSetNamedItemNS3() throws Throwable { Document doc; @@ -189,16 +179,12 @@ public final class NamedNodeMapSetNamedItemNS extends DOMTestCase { assertTrue("throw_WRONG_DOCUMENT_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that setNamedItemNS throws DOMException with " + - "WRONG_DOCUMENT_ERR code.", - targets = { - @TestTarget( - methodName = "setNamedItemNS", - methodArgs = {org.w3c.dom.Node.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that setNamedItemNS throws DOMException with WRONG_DOCUMENT_ERR code.", + method = "setNamedItemNS", + args = {org.w3c.dom.Node.class} + ) public void testSetNamedItemNS4() throws Throwable { Document doc; DOMImplementation domImpl; @@ -269,16 +255,12 @@ public final class NamedNodeMapSetNamedItemNS extends DOMTestCase { // assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_notations", success); // } // } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that setNamedItemNS throws DOMException with " + - "INUSE_ATTRIBUTE_ERR code.", - targets = { - @TestTarget( - methodName = "setNamedItemNS", - methodArgs = {org.w3c.dom.Node.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that setNamedItemNS throws DOMException with INUSE_ATTRIBUTE_ERR code.", + method = "setNamedItemNS", + args = {org.w3c.dom.Node.class} + ) public void testSetNamedItemNS6() throws Throwable { Document doc; NamedNodeMap attributes; @@ -305,16 +287,12 @@ public final class NamedNodeMapSetNamedItemNS extends DOMTestCase { assertTrue("namednodemapsetnameditemns06", success); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that setNamedItemNS throws DOMException with " + - "INUSE_ATTRIBUTE_ERR code.", - targets = { - @TestTarget( - methodName = "setNamedItemNS", - methodArgs = {org.w3c.dom.Node.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that setNamedItemNS throws DOMException with INUSE_ATTRIBUTE_ERR code.", + method = "setNamedItemNS", + args = {org.w3c.dom.Node.class} + ) public void testSetNamedItemNS7() throws Throwable { Document doc; NamedNodeMap attributes; @@ -341,16 +319,12 @@ public final class NamedNodeMapSetNamedItemNS extends DOMTestCase { assertTrue("namednodemapsetnameditemns07", success); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that setNamedItemNS throws DOMException with " + - "INUSE_ATTRIBUTE_ERR code.", - targets = { - @TestTarget( - methodName = "setNamedItemNS", - methodArgs = {org.w3c.dom.Node.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that setNamedItemNS throws DOMException with INUSE_ATTRIBUTE_ERR code.", + method = "setNamedItemNS", + args = {org.w3c.dom.Node.class} + ) public void testSetNamedItemNS8() throws Throwable { Document doc; NamedNodeMap attributes; diff --git a/xml/src/test/java/tests/org/w3c/dom/NamespaceURI.java b/xml/src/test/java/tests/org/w3c/dom/NamespaceURI.java index 788ef8b..dba8b86 100644 --- a/xml/src/test/java/tests/org/w3c/dom/NamespaceURI.java +++ b/xml/src/test/java/tests/org/w3c/dom/NamespaceURI.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Attr; @@ -94,15 +94,12 @@ public final class NamespaceURI extends DOMTestCase { // attrNamespaceURI = addrAttr.getNamespaceURI(); // assertEquals("namespaceURI", "http://www.nist.gov", attrNamespaceURI); // } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify that getNamespaceURI method returns null.", - targets = { - @TestTarget( - methodName = "getNamespaceURI", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify that getNamespaceURI method returns null.", + method = "getNamespaceURI", + args = {} + ) public void testGetNamespaceURI2() throws Throwable { Document doc; NodeList elementList; @@ -118,15 +115,12 @@ public final class NamespaceURI extends DOMTestCase { attrNamespaceURI = addrAttr.getNamespaceURI(); assertEquals("namespaceURI", "http://www.nist.gov", attrNamespaceURI); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify that getNamespaceURI method returns null.", - targets = { - @TestTarget( - methodName = "getNamespaceURI", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify that getNamespaceURI method returns null.", + method = "getNamespaceURI", + args = {} + ) public void testGetNamespaceURI3() throws Throwable { Document doc; NodeList elementList; @@ -139,15 +133,12 @@ public final class NamespaceURI extends DOMTestCase { employeeNamespace = testEmployee.getNamespaceURI(); assertEquals("namespaceURI", "http://www.nist.gov", employeeNamespace); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that getNamespaceURI method returns null.", - targets = { - @TestTarget( - methodName = "getNamespaceURI", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that getNamespaceURI method returns null.", + method = "getNamespaceURI", + args = {} + ) public void testGetNamespaceURI4() throws Throwable { Document doc; NodeList elementList; diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeGetLocalName.java b/xml/src/test/java/tests/org/w3c/dom/NodeGetLocalName.java index 66c5b25..d508465 100644 --- a/xml/src/test/java/tests/org/w3c/dom/NodeGetLocalName.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeGetLocalName.java @@ -22,9 +22,9 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Node; @@ -72,15 +72,12 @@ public final class NodeGetLocalName extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify that getLocalName method returns null.", - targets = { - @TestTarget( - methodName = "getLocalName", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify that getLocalName method returns null.", + method = "getLocalName", + args = {} + ) public void testGetLocalName() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeGetNamespaceURI.java b/xml/src/test/java/tests/org/w3c/dom/NodeGetNamespaceURI.java index e53d6cb..5ed1e29 100644 --- a/xml/src/test/java/tests/org/w3c/dom/NodeGetNamespaceURI.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeGetNamespaceURI.java @@ -22,9 +22,9 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Node; @@ -74,15 +74,12 @@ public final class NodeGetNamespaceURI extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getNamespaceURI", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getNamespaceURI", + args = {} + ) public void testGetNamespaceURI() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeGetOwnerDocument.java b/xml/src/test/java/tests/org/w3c/dom/NodeGetOwnerDocument.java index 7034ea4..3579c15 100644 --- a/xml/src/test/java/tests/org/w3c/dom/NodeGetOwnerDocument.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeGetOwnerDocument.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Node; @@ -78,15 +78,12 @@ public final class NodeGetOwnerDocument extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that getOwnerDocument method returns null.", - targets = { - @TestTarget( - methodName = "getOwnerDocument", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that getOwnerDocument method returns null.", + method = "getOwnerDocument", + args = {} + ) public void testGetOwnerDocument1() throws Throwable { Document doc; Document ownerDoc; @@ -100,15 +97,12 @@ public final class NodeGetOwnerDocument extends DOMTestCase { ownerDoc = docType.getOwnerDocument(); assertNull("nodegetownerdocument01", ownerDoc); } - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getOwnerDocument", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getOwnerDocument", + args = {} + ) public void testGetOwnerDocument2() throws Throwable { Document doc; Document newDoc; diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeGetPrefix.java b/xml/src/test/java/tests/org/w3c/dom/NodeGetPrefix.java index e9cfa21..bcf8bba 100644 --- a/xml/src/test/java/tests/org/w3c/dom/NodeGetPrefix.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeGetPrefix.java @@ -22,9 +22,9 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Node; @@ -73,15 +73,12 @@ public final class NodeGetPrefix extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getPrefix", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getPrefix", + args = {} + ) public void testGetPrefix() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeHasAttributes.java b/xml/src/test/java/tests/org/w3c/dom/NodeHasAttributes.java index d7b0cf6..514b205 100644 --- a/xml/src/test/java/tests/org/w3c/dom/NodeHasAttributes.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeHasAttributes.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Node; @@ -77,15 +77,12 @@ public final class NodeHasAttributes extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "hasAttributes", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "hasAttributes", + args = {} + ) public void testHasAttributes1() throws Throwable { Document doc; Element element; @@ -101,15 +98,12 @@ public final class NodeHasAttributes extends DOMTestCase { hasAttributes = element.hasAttributes(); assertTrue("nodehasattributes01_2", hasAttributes); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that hasAttributes method returns false value.", - targets = { - @TestTarget( - methodName = "hasAttributes", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that hasAttributes method returns false value.", + method = "hasAttributes", + args = {} + ) public void testHasAttributes2() throws Throwable { Document doc; DocumentType docType; @@ -119,15 +113,12 @@ public final class NodeHasAttributes extends DOMTestCase { hasAttributes = docType.hasAttributes(); assertFalse("nodehasattributes02", hasAttributes); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that hasAttributes method returns true value.", - targets = { - @TestTarget( - methodName = "hasAttributes", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that hasAttributes method returns true value.", + method = "hasAttributes", + args = {} + ) public void testHasAttributes3() throws Throwable { Document doc; Element element; @@ -140,15 +131,12 @@ public final class NodeHasAttributes extends DOMTestCase { hasAttributes = element.hasAttributes(); assertTrue("hasAttributes", hasAttributes); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that hasAttributes method returns true value.", - targets = { - @TestTarget( - methodName = "hasAttributes", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that hasAttributes method returns true value.", + method = "hasAttributes", + args = {} + ) public void testHasAttributes4() throws Throwable { Document doc; Document newDoc; diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeIsSupported.java b/xml/src/test/java/tests/org/w3c/dom/NodeIsSupported.java index f0f9110..d88cb86 100644 --- a/xml/src/test/java/tests/org/w3c/dom/NodeIsSupported.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeIsSupported.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.ArrayList; @@ -85,15 +85,12 @@ public final class NodeIsSupported extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify that isSupported method can return false value.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify that isSupported method can return false value.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported1() throws Throwable { Document doc; Element element; @@ -129,15 +126,12 @@ public final class NodeIsSupported extends DOMTestCase { assertTrue("nodeissupported01_Core3", success); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify that isSupported method can return false value.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify that isSupported method can return false value.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported2() throws Throwable { Document doc; Attr attribute; @@ -173,16 +167,12 @@ public final class NodeIsSupported extends DOMTestCase { assertTrue("nodeissupported02_Core3", success); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that isSupported method returns false value " + - "if it's called with empty strings as parameters.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that isSupported method returns false value if it's called with empty strings as parameters.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported3() throws Throwable { Document doc; DocumentType docType; @@ -192,15 +182,12 @@ public final class NodeIsSupported extends DOMTestCase { success = docType.isSupported("", ""); assertFalse("nodeissupported03", success); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that isSupported method returns false value.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that isSupported method returns false value.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported4() throws Throwable { Document doc; EntityReference entRef; @@ -211,15 +198,12 @@ public final class NodeIsSupported extends DOMTestCase { success = entRef.isSupported("XML CORE", ""); assertFalse("nodeissupported04", success); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that isSupported method returns false value.", - targets = { - @TestTarget( - methodName = "isSupported", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that isSupported method returns false value.", + method = "isSupported", + args = {java.lang.String.class, java.lang.String.class} + ) public void testIsSupported5() throws Throwable { Document doc; ProcessingInstruction pi; diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeNormalize.java b/xml/src/test/java/tests/org/w3c/dom/NodeNormalize.java index 664ad22..d66ce58 100644 --- a/xml/src/test/java/tests/org/w3c/dom/NodeNormalize.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeNormalize.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Node; @@ -87,15 +87,12 @@ public final class NodeNormalize extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "normalize", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "normalize", + args = {} + ) public void testNormalize() throws Throwable { Document doc; Document newDoc; diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeSetPrefix.java b/xml/src/test/java/tests/org/w3c/dom/NodeSetPrefix.java index ca2844f..dbecc30 100644 --- a/xml/src/test/java/tests/org/w3c/dom/NodeSetPrefix.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeSetPrefix.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import java.util.ArrayList; @@ -84,15 +84,12 @@ public final class NodeSetPrefix extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "setPrefix", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "setPrefix", + args = {java.lang.String.class} + ) public void testSetPrefix1() throws Throwable { Document doc; DocumentFragment docFragment; @@ -137,15 +134,12 @@ public final class NodeSetPrefix extends DOMTestCase { // assertEquals("nodesetprefix02_attrName", "dmstc:domestic", attrName); // assertEquals("nodesetprefix02_newAttrName", "dom:address", newAttrName); // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "setPrefix", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with NAMESPACE_ERR code.", + method = "setPrefix", + args = {java.lang.String.class} + ) public void testSetPrefix3() throws Throwable { Document doc; Element element; @@ -187,15 +181,12 @@ public final class NodeSetPrefix extends DOMTestCase { // assertTrue("nodesetprefix04", success); // } // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "setPrefix", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with NAMESPACE_ERR code.", + method = "setPrefix", + args = {java.lang.String.class} + ) public void testSetPrefix5() throws Throwable { Document doc; Element element; @@ -224,15 +215,12 @@ public final class NodeSetPrefix extends DOMTestCase { } } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "setPrefix", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with NAMESPACE_ERR code.", + method = "setPrefix", + args = {java.lang.String.class} + ) public void testSetPrefix6() throws Throwable { Document doc; Element element; @@ -250,15 +238,12 @@ public final class NodeSetPrefix extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "setPrefix", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with NAMESPACE_ERR code.", + method = "setPrefix", + args = {java.lang.String.class} + ) public void testSetPrefix7() throws Throwable { Document doc; Attr attribute; @@ -276,15 +261,12 @@ public final class NodeSetPrefix extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with NAMESPACE_ERR.", - targets = { - @TestTarget( - methodName = "setPrefix", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with NAMESPACE_ERR.", + method = "setPrefix", + args = {java.lang.String.class} + ) public void testSetPrefix8() throws Throwable { Document doc; Element element; @@ -305,15 +287,12 @@ public final class NodeSetPrefix extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with INVALID_CHARACTER_ERR code.", - targets = { - @TestTarget( - methodName = "setPrefix", - methodArgs = {java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with INVALID_CHARACTER_ERR code.", + method = "setPrefix", + args = {java.lang.String.class} + ) public void _testSetPrefix9() throws Throwable { Document doc; String value = "#$%&'()@"; diff --git a/xml/src/test/java/tests/org/w3c/dom/Normalize.java b/xml/src/test/java/tests/org/w3c/dom/Normalize.java index 40b4b29..36ff43c 100644 --- a/xml/src/test/java/tests/org/w3c/dom/Normalize.java +++ b/xml/src/test/java/tests/org/w3c/dom/Normalize.java @@ -22,9 +22,9 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Element; @@ -77,15 +77,12 @@ public final class Normalize extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "normalize", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "normalize", + args = {} + ) public void testNormalize() throws Throwable { Document doc; Element root; diff --git a/xml/src/test/java/tests/org/w3c/dom/OwnerDocument.java b/xml/src/test/java/tests/org/w3c/dom/OwnerDocument.java index 3a2537b..b5b0e94 100644 --- a/xml/src/test/java/tests/org/w3c/dom/OwnerDocument.java +++ b/xml/src/test/java/tests/org/w3c/dom/OwnerDocument.java @@ -22,9 +22,9 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Document; @@ -70,15 +70,12 @@ public final class OwnerDocument extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Dosn't verify that getOwnerDocument can return not null value.", - targets = { - @TestTarget( - methodName = "getOwnerDocument", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Dosn't verify that getOwnerDocument can return not null value.", + method = "getOwnerDocument", + args = {} + ) public void testGetOwnerDocument() throws Throwable { Document doc; DocumentType ownerDocument; diff --git a/xml/src/test/java/tests/org/w3c/dom/OwnerElement.java b/xml/src/test/java/tests/org/w3c/dom/OwnerElement.java index 267d314..a4af36a 100644 --- a/xml/src/test/java/tests/org/w3c/dom/OwnerElement.java +++ b/xml/src/test/java/tests/org/w3c/dom/OwnerElement.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Node; @@ -77,15 +77,12 @@ public final class OwnerElement extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies positive functionlity.", - targets = { - @TestTarget( - methodName = "getOwnerElement", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies positive functionlity.", + method = "getOwnerElement", + args = {} + ) public void testGetOwnerElement1() throws Throwable { Document doc; NodeList addressList; @@ -103,15 +100,12 @@ public final class OwnerElement extends DOMTestCase { name = elementNode.getNodeName(); assertEquals("throw_Equals", "address", name); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that getOwnerElement method returns null.", - targets = { - @TestTarget( - methodName = "getOwnerElement", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that getOwnerElement method returns null.", + method = "getOwnerElement", + args = {} + ) public void testGetOwnerElement2() throws Throwable { Document doc; Attr newAttr; diff --git a/xml/src/test/java/tests/org/w3c/dom/Prefix.java b/xml/src/test/java/tests/org/w3c/dom/Prefix.java index 60bd3e4..f45144a 100644 --- a/xml/src/test/java/tests/org/w3c/dom/Prefix.java +++ b/xml/src/test/java/tests/org/w3c/dom/Prefix.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Node; @@ -79,15 +79,12 @@ public final class Prefix extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that getPrefix method can return null.", - targets = { - @TestTarget( - methodName = "getPrefix", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that getPrefix method can return null.", + method = "getPrefix", + args = {} + ) public void testGetPrefix1() throws Throwable { Document doc; Node createdNode; @@ -97,15 +94,12 @@ public final class Prefix extends DOMTestCase { prefix = createdNode.getPrefix(); assertNull("throw_Null", prefix); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies positive functionality of getPrefix method.", - targets = { - @TestTarget( - methodName = "getPrefix", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies positive functionality of getPrefix method.", + method = "getPrefix", + args = {} + ) public void testGetPrefix2() throws Throwable { Document doc; NodeList elementList; @@ -120,15 +114,12 @@ public final class Prefix extends DOMTestCase { prefix = textNode.getPrefix(); assertNull("textNodePrefix", prefix); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies positive functionality of getPrefix method.", - targets = { - @TestTarget( - methodName = "getPrefix", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies positive functionality of getPrefix method.", + method = "getPrefix", + args = {} + ) public void testGetPrefix3() throws Throwable { Document doc; NodeList elementList; @@ -141,15 +132,12 @@ public final class Prefix extends DOMTestCase { prefix = testEmployee.getPrefix(); assertEquals("prefix", "emp", prefix); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that getPrefix method returns null.", - targets = { - @TestTarget( - methodName = "getPrefix", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that getPrefix method returns null.", + method = "getPrefix", + args = {} + ) public void testGetPrefix4() throws Throwable { Document doc; NodeList elementList; @@ -161,16 +149,12 @@ public final class Prefix extends DOMTestCase { prefix = testEmployee.getPrefix(); assertNull("throw_Null", prefix); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that getPrefix method throws DOMException with " + - "NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "getPrefix", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that getPrefix method throws DOMException with NAMESPACE_ERR code.", + method = "getPrefix", + args = {} + ) public void testGetPrefix5() throws Throwable { Document doc; NodeList elementList; @@ -192,16 +176,12 @@ public final class Prefix extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that getPrefix method throws DOMException with " + - "INVALID_CHARACTER_ERR code.", - targets = { - @TestTarget( - methodName = "getPrefix", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that getPrefix method throws DOMException with INVALID_CHARACTER_ERR code.", + method = "getPrefix", + args = {} + ) public void _testGetPrefix6() throws Throwable { Document doc; NodeList elementList; @@ -220,16 +200,12 @@ public final class Prefix extends DOMTestCase { assertTrue("throw_INVALID_CHARACTER_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that getPrefix method throws DOMException with " + - "NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "getPrefix", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that getPrefix method throws DOMException with NAMESPACE_ERR code.", + method = "getPrefix", + args = {} + ) public void testGetPrefix7() throws Throwable { Document doc; NodeList elementList; @@ -282,16 +258,12 @@ public final class Prefix extends DOMTestCase { // assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); // } // } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that getPrefix method throws DOMException with " + - "NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "getPrefix", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that getPrefix method throws DOMException with NAMESPACE_ERR code.", + method = "getPrefix", + args = {} + ) public void _testGetPrefix9() throws Throwable { Document doc; NodeList elementList; @@ -312,16 +284,12 @@ public final class Prefix extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that getPrefix method throws DOMException with " + - "NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "getPrefix", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that getPrefix method throws DOMException with NAMESPACE_ERR code.", + method = "getPrefix", + args = {} + ) public void testGetPrefix10() throws Throwable { Document doc; NodeList elementList; @@ -340,16 +308,12 @@ public final class Prefix extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies that getPrefix method throws DOMException with " + - "NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "getPrefix", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies that getPrefix method throws DOMException with NAMESPACE_ERR code.", + method = "getPrefix", + args = {} + ) public void testGetPrefix11() throws Throwable { Document doc; NodeList elementList; diff --git a/xml/src/test/java/tests/org/w3c/dom/PublicId.java b/xml/src/test/java/tests/org/w3c/dom/PublicId.java index a366e2d..8165b2c 100644 --- a/xml/src/test/java/tests/org/w3c/dom/PublicId.java +++ b/xml/src/test/java/tests/org/w3c/dom/PublicId.java @@ -22,9 +22,9 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.DocumentType; @@ -71,15 +71,12 @@ public final class PublicId extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getPublicId", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getPublicId", + args = {} + ) public void testGetPublicId() throws Throwable { Document doc; DocumentType docType; diff --git a/xml/src/test/java/tests/org/w3c/dom/RemoveNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/RemoveNamedItemNS.java index e4a6656..e745e74 100644 --- a/xml/src/test/java/tests/org/w3c/dom/RemoveNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/RemoveNamedItemNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.NamedNodeMap; @@ -80,15 +80,12 @@ public final class RemoveNamedItemNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify DOMException exception.", - targets = { - @TestTarget( - methodName = "removeNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify DOMException exception.", + method = "removeNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testRemoveNamedItemNS1() throws Throwable { Document doc; NodeList elementList; @@ -106,15 +103,12 @@ public final class RemoveNamedItemNS extends DOMTestCase { newAttr = (Attr) attributes.getNamedItem("dmstc:domestic"); assertNull("nodeRemoved", newAttr); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Verifies DOMException with NOT_FOUND_ERR code.", - targets = { - @TestTarget( - methodName = "removeNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Verifies DOMException with NOT_FOUND_ERR code.", + method = "removeNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testRemoveNamedItemNS2() throws Throwable { String namespaceURI = "http://www.usa.com"; String localName = "domest"; diff --git a/xml/src/test/java/tests/org/w3c/dom/SetAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/SetAttributeNS.java index 5ecf072..58c146f 100644 --- a/xml/src/test/java/tests/org/w3c/dom/SetAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/SetAttributeNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Element; @@ -82,15 +82,12 @@ public final class SetAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with INVALID_CHARACTER_ERR code.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with INVALID_CHARACTER_ERR code.", + method = "setAttributeNS", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testSetAttributeNS1() throws Throwable { String namespaceURI = "http://www.nist.gov"; String qualifiedName = "emp:qual?name"; @@ -112,15 +109,12 @@ public final class SetAttributeNS extends DOMTestCase { assertTrue("throw_INVALID_CHARACTER_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with NAMESPACE_ERR code.", + method = "setAttributeNS", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testSetAttributeNS2() throws Throwable { String namespaceURI = "http://www.nist.gov"; String qualifiedName = "emp:"; @@ -181,15 +175,12 @@ public final class SetAttributeNS extends DOMTestCase { // assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); // } // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive functionality.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, boolean.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive functionality.", + method = "setAttributeNS", + args = {String.class, String.class, String.class} + ) public void testSetAttributeNS4() throws Throwable { Document doc; NodeList elementList; @@ -217,15 +208,13 @@ public final class SetAttributeNS extends DOMTestCase { resultPrefix = addrAttr.getPrefix(); assertEquals("prefix", "newprefix", resultPrefix); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive functionality.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive functionality.", + method = "setAttributeNS", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testSetAttributeNS5() throws Throwable { String localName = "newAttr"; String namespaceURI = "http://www.newattr.com"; @@ -245,15 +234,12 @@ public final class SetAttributeNS extends DOMTestCase { namespaceURI, localName); assertEquals("throw_Equals", "<newValue>", resultAttr); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with NAMESPACE_ERR code.", + method = "setAttributeNS", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testSetAttributeNS6() throws Throwable { String namespaceURI = "http://www.nist.gov"; String qualifiedName = "xml:qualifiedName"; @@ -275,15 +261,12 @@ public final class SetAttributeNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with NAMESPACE_ERR.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with NAMESPACE_ERR.", + method = "setAttributeNS", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testSetAttributeNS7() throws Throwable { String namespaceURI = "http://www.nist.gov"; String qualifiedName = "xmlns"; @@ -305,15 +288,12 @@ public final class SetAttributeNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive functionality.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive functionality.", + method = "setAttributeNS", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testSetAttributeNS9() throws Throwable { String localName = "newAttr"; String namespaceURI = "http://www.newattr.com"; @@ -344,15 +324,12 @@ public final class SetAttributeNS extends DOMTestCase { resultPrefix = addrAttr.getPrefix(); assertEquals("prefix", "emp", resultPrefix); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with NAMESPACE_ERR code.", - targets = { - @TestTarget( - methodName = "setAttributeNS", - methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with NAMESPACE_ERR code.", + method = "setAttributeNS", + args = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) public void testSetAttributeNS10() throws Throwable { String namespaceURI = "http://www.example.gov"; Document doc; diff --git a/xml/src/test/java/tests/org/w3c/dom/SetAttributeNodeNS.java b/xml/src/test/java/tests/org/w3c/dom/SetAttributeNodeNS.java index c26bc47..3960a4f 100644 --- a/xml/src/test/java/tests/org/w3c/dom/SetAttributeNodeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/SetAttributeNodeNS.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.Element; @@ -85,15 +85,12 @@ public final class SetAttributeNodeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.", - targets = { - @TestTarget( - methodName = "setAttributeNodeNS", - methodArgs = {org.w3c.dom.Attr.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.", + method = "setAttributeNodeNS", + args = {org.w3c.dom.Attr.class} + ) public void testSetAttributeNode1() throws Throwable { String namespaceURI = "http://www.newattr.com"; String qualifiedName = "emp:newAttr"; @@ -160,15 +157,12 @@ public final class SetAttributeNodeNS extends DOMTestCase { // assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); // } // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "setAttributeNodeNS", - methodArgs = {org.w3c.dom.Attr.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "setAttributeNodeNS", + args = {org.w3c.dom.Attr.class} + ) public void testSetAttributeNode3() throws Throwable { String namespaceURI = "http://www.newattr.com"; String qualifiedName = "emp:newAttr"; @@ -186,15 +180,12 @@ public final class SetAttributeNodeNS extends DOMTestCase { .setAttributeNodeNS(newAttr); assertNull("throw_Null", newAddrAttr); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Doesn't verify DOMException.", - targets = { - @TestTarget( - methodName = "setAttributeNodeNS", - methodArgs = {org.w3c.dom.Attr.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Doesn't verify DOMException.", + method = "setAttributeNodeNS", + args = {org.w3c.dom.Attr.class} + ) public void testSetAttributeNode4() throws Throwable { Document doc; NodeList elementList; @@ -212,15 +203,12 @@ public final class SetAttributeNodeNS extends DOMTestCase { newName = newAddrAttr.getNodeName(); assertEquals("nodeName", "emp:domestic", newName); } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with WRONG_DOCUMENT_ERR code.", - targets = { - @TestTarget( - methodName = "setAttributeNodeNS", - methodArgs = {org.w3c.dom.Attr.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with WRONG_DOCUMENT_ERR code.", + method = "setAttributeNodeNS", + args = {org.w3c.dom.Attr.class} + ) public void testSetAttributeNode5() throws Throwable { String namespaceURI = "http://www.newattr.com"; String qualifiedName = "emp:newAttr"; diff --git a/xml/src/test/java/tests/org/w3c/dom/SetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/SetNamedItemNS.java index 2237eff..ae364ec 100644 --- a/xml/src/test/java/tests/org/w3c/dom/SetNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/SetNamedItemNS.java @@ -22,9 +22,9 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.NamedNodeMap; @@ -79,15 +79,12 @@ public final class SetNamedItemNS extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.", - targets = { - @TestTarget( - methodName = "setNamedItemNS", - methodArgs = {org.w3c.dom.Node.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.", + method = "setNamedItemNS", + args = {org.w3c.dom.Node.class} + ) public void testSetNamedItemNS1() throws Throwable { Document doc; NodeList elementList; @@ -115,15 +112,12 @@ public final class SetNamedItemNS extends DOMTestCase { assertTrue("throw_INUSE_ATTRIBUTE_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies DOMException with WRONG_DOCUMENT_ERR code.", - targets = { - @TestTarget( - methodName = "setNamedItemNS", - methodArgs = {org.w3c.dom.Node.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies DOMException with WRONG_DOCUMENT_ERR code.", + method = "setNamedItemNS", + args = {org.w3c.dom.Node.class} + ) public void testSetNamedItemNS2() throws Throwable { String namespaceURI = "http://www.usa.com"; String qualifiedName = "dmstc:domestic"; @@ -152,15 +146,12 @@ public final class SetNamedItemNS extends DOMTestCase { assertTrue("throw_WRONG_DOCUMENT_ERR", success); } } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive fnctionality.", - targets = { - @TestTarget( - methodName = "getNamedItemNS", - methodArgs = {java.lang.String.class, java.lang.String.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive fnctionality.", + method = "getNamedItemNS", + args = {java.lang.String.class, java.lang.String.class} + ) public void testSetNamedItemNS3() throws Throwable { String namespaceURI = "http://www.nist.gov"; String qualifiedName = "prefix:newAttr"; @@ -226,15 +217,12 @@ public final class SetNamedItemNS extends DOMTestCase { // assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); // } // } - @TestInfo( - level = TestLevel.PARTIAL_OK, - purpose = "Verifies positive fnctionality.", - targets = { - @TestTarget( - methodName = "setNamedItemNS", - methodArgs = {org.w3c.dom.Node.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL_COMPLETE, + notes = "Verifies positive fnctionality.", + method = "setNamedItemNS", + args = {org.w3c.dom.Node.class} + ) public void testSetNamedItemNS5() throws Throwable { String namespaceURI = "http://www.usa.com"; String qualifiedName = "dmstc:domestic"; diff --git a/xml/src/test/java/tests/org/w3c/dom/SystemId.java b/xml/src/test/java/tests/org/w3c/dom/SystemId.java index e3bde42..3e1b903 100644 --- a/xml/src/test/java/tests/org/w3c/dom/SystemId.java +++ b/xml/src/test/java/tests/org/w3c/dom/SystemId.java @@ -21,9 +21,9 @@ package tests.org.w3c.dom; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import org.w3c.dom.DocumentType; @@ -73,15 +73,12 @@ public final class SystemId extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - @TestInfo( - level = TestLevel.COMPLETE, - purpose = "", - targets = { - @TestTarget( - methodName = "getSystemId", - methodArgs = {} - ) - }) + @TestTargetNew( + level = TestLevel.COMPLETE, + notes = "", + method = "getSystemId", + args = {} + ) public void testGetSystemId() throws Throwable { Document doc; DocumentType docType; diff --git a/xml/src/test/java/tests/xml/AllTests.java b/xml/src/test/java/tests/xml/AllTests.java index 146eb57..eefae50 100644 --- a/xml/src/test/java/tests/xml/AllTests.java +++ b/xml/src/test/java/tests/xml/AllTests.java @@ -22,15 +22,17 @@ import junit.framework.TestSuite; public class AllTests { public static Test suite() { - TestSuite suite = new TestSuite(); + TestSuite suite = tests.TestSuiteFactory.createTestSuite(); suite.addTestSuite(SimpleParserTest.class); suite.addTestSuite(SimpleBuilderTest.class); - suite.addTest(tests.org.w3c.dom.AllTests.suite()); + //suite.addTest(tests.org.w3c.dom.AllTests.suite()); suite.addTest(tests.api.javax.xml.parsers.AllTests.suite()); - - return suite; + + suite.addTest(tests.api.org.xml.sax.AllTests.suite()); + + return suite; } } diff --git a/xml/src/test/java/tests/xml/SimpleBuilderTest.java b/xml/src/test/java/tests/xml/SimpleBuilderTest.java index c25698c..1a555c6 100644 --- a/xml/src/test/java/tests/xml/SimpleBuilderTest.java +++ b/xml/src/test/java/tests/xml/SimpleBuilderTest.java @@ -16,9 +16,10 @@ package tests.xml; -import dalvik.annotation.TestInfo; +import dalvik.annotation.BrokenTest; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import junit.framework.TestCase; @@ -63,15 +64,12 @@ public class SimpleBuilderTest extends TestCase { return result; } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Regression test.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.InputStream.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Regression test.", + method = "parse", + args = {java.io.InputStream.class} + ) public void testGoodFile1() throws Exception { Document document = builder.parse(getClass().getResourceAsStream( "/SimpleBuilderTest.xml")); @@ -124,15 +122,12 @@ public class SimpleBuilderTest extends TestCase { assertEquals("The quick brown fox jumps over the lazy dog.", proinst); assertEquals(" Fragile! Handle me with care! ", comment); } - @TestInfo( - level = TestLevel.TODO, - purpose = "Doesn't verify anything.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.InputStream.class} - ) - }) + @TestTargetNew( + level = TestLevel.ADDITIONAL, + method = "!todo parse", + args = {java.io.InputStream.class} + ) + @BrokenTest("Doesn't verify anything.") public void testGoodFile2() throws Exception { Document document = builder.parse(getClass().getResourceAsStream( "/staffNS.xml")); diff --git a/xml/src/test/java/tests/xml/SimpleParserTest.java b/xml/src/test/java/tests/xml/SimpleParserTest.java index 0d63262..4651039 100644 --- a/xml/src/test/java/tests/xml/SimpleParserTest.java +++ b/xml/src/test/java/tests/xml/SimpleParserTest.java @@ -16,9 +16,9 @@ package tests.xml; -import dalvik.annotation.TestInfo; +import dalvik.annotation.TestTargets; import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetNew; import dalvik.annotation.TestTargetClass; import junit.framework.TestCase; @@ -166,16 +166,12 @@ public class SimpleParserTest extends TestCase implements ContentHandler { public void startPrefixMapping(String prefix, String uri) { } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.InputStream.class, - org.xml.sax.helpers.DefaultHandler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "", + method = "parse", + args = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class} + ) public void testWorkingFile1() throws Exception { SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(false); @@ -200,15 +196,12 @@ public class SimpleParserTest extends TestCase implements ContentHandler { assertEquals("http://www.foobar.org", namespaces1.get("stuff")); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "", + method = "parse", + args = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class} + ) public void testWorkingFile2() throws Exception { SAXParserFactory factory = SAXParserFactory.newInstance(); @@ -237,15 +230,12 @@ public class SimpleParserTest extends TestCase implements ContentHandler { assertEquals(0, namespaces2.size()); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify exceptions.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify exceptions.", + method = "parse", + args = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class} + ) public void testEntityResolver() throws Exception { final StringBuilder text = new StringBuilder(); DefaultHandler handler = new DefaultHandler() { @@ -275,15 +265,12 @@ public class SimpleParserTest extends TestCase implements ContentHandler { "resolved external entity must be in parser character stream", text.toString().contains("test")); } - @TestInfo( - level = TestLevel.PARTIAL, - purpose = "Doesn't verify exceptions.", - targets = { - @TestTarget( - methodName = "parse", - methodArgs = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class} - ) - }) + @TestTargetNew( + level = TestLevel.PARTIAL, + notes = "Doesn't verify exceptions.", + method = "parse", + args = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class} + ) public void testGetValue() throws Exception{ parser.parse(getClass().getResourceAsStream("/staffNS.xml"), new DefaultHandler() { |