Source Code Cross Referenced for XMLTestCase.java in  » Testing » XMLUnit » org » custommonkey » xmlunit » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » XMLUnit » org.custommonkey.xmlunit 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         ******************************************************************
0003:        Copyright (c) 2001, Jeff Martin, Tim Bacon
0004:        All rights reserved.
0005:
0006:        Redistribution and use in source and binary forms, with or without
0007:        modification, are permitted provided that the following conditions
0008:        are met:
0009:
0010:         * Redistributions of source code must retain the above copyright
0011:              notice, this list of conditions and the following disclaimer.
0012:         * Redistributions in binary form must reproduce the above
0013:              copyright notice, this list of conditions and the following
0014:              disclaimer in the documentation and/or other materials provided
0015:              with the distribution.
0016:         * Neither the name of the xmlunit.sourceforge.net nor the names
0017:              of its contributors may be used to endorse or promote products
0018:              derived from this software without specific prior written
0019:              permission.
0020:
0021:        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0022:        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0023:        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
0024:        FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
0025:        COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
0026:        INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
0027:        BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
0028:        LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
0029:        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0030:        LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
0031:        ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0032:        POSSIBILITY OF SUCH DAMAGE.
0033:
0034:         ******************************************************************
0035:         */
0036:
0037:        package org.custommonkey.xmlunit;
0038:
0039:        import org.custommonkey.xmlunit.exceptions.ConfigurationException;
0040:        import org.custommonkey.xmlunit.exceptions.XpathException;
0041:
0042:        import java.io.IOException;
0043:        import java.io.Reader;
0044:        import java.io.StringReader;
0045:
0046:        import junit.framework.TestCase;
0047:        import org.w3c.dom.Document;
0048:        import org.xml.sax.InputSource;
0049:        import org.xml.sax.SAXException;
0050:
0051:        /**
0052:         * JUnit TestCase subclass: extend this to add XML assertion facilities to your
0053:         * test suites.
0054:         * Available assertions are provided by static methods of the {@link XMLAssert
0055:         * XMLAssert} class.
0056:         * NB: All underlying similarity and difference testing is done using {@link
0057:         * Diff Diff} instances which can be instantiated and evaluated independently of
0058:         * an XMLTestCase.
0059:         * @see Diff#similar()
0060:         * @see Diff#identical()
0061:         * <br />Examples and more at <a href="http://xmlunit.sourceforge.net"/>xmlunit.sourceforge.net</a>
0062:         */
0063:        public abstract class XMLTestCase extends TestCase implements 
0064:                XSLTConstants {
0065:            /**
0066:             * Construct a new XML test case.
0067:             */
0068:            public XMLTestCase() {
0069:                super ();
0070:            }
0071:
0072:            /**
0073:             * Construct a new test case.
0074:             * @param name Name of test
0075:             */
0076:            public XMLTestCase(String name) {
0077:                super (name);
0078:            }
0079:
0080:            /**
0081:             * Compare XML documents provided by two InputSource classes
0082:             * @param control Control document
0083:             * @param test Document to test
0084:             * @return Diff object describing differences in documents
0085:             * @throws SAXException
0086:             * @throws IOException
0087:             */
0088:            public Diff compareXML(InputSource control, InputSource test)
0089:                    throws SAXException, IOException {
0090:                return XMLUnit.compareXML(control, test);
0091:            }
0092:
0093:            /**
0094:             * Compare XML documents provided by two Reader classes
0095:             * @param control Control document
0096:             * @param test Document to test
0097:             * @return Diff object describing differences in documents
0098:             * @throws SAXException
0099:             * @throws IOException
0100:             */
0101:            public Diff compareXML(Reader control, Reader test)
0102:                    throws SAXException, IOException {
0103:                return XMLUnit.compareXML(control, test);
0104:            }
0105:
0106:            /**
0107:             * Compare XML documents provided by two Reader classes
0108:             * @param control Control document
0109:             * @param test Document to test
0110:             * @return Diff object describing differences in documents
0111:             * @throws SAXException
0112:             * @throws IOException
0113:             */
0114:            public Diff compareXML(String control, Reader test)
0115:                    throws SAXException, IOException {
0116:                return XMLUnit.compareXML(new StringReader(control), test);
0117:            }
0118:
0119:            /**
0120:             * Compare XML documents provided by two Reader classes
0121:             * @param control Control document
0122:             * @param test Document to test
0123:             * @return Diff object describing differences in documents
0124:             * @throws SAXException
0125:             * @throws IOException
0126:             */
0127:            public Diff compareXML(Reader control, String test)
0128:                    throws SAXException, IOException {
0129:                return XMLUnit.compareXML(control, new StringReader(test));
0130:            }
0131:
0132:            /**
0133:             * Compare two XML documents provided as strings
0134:             * @param control Control document
0135:             * @param test Document to test
0136:             * @return Diff object describing differences in documents
0137:             * @throws SAXException
0138:             * @throws IOException
0139:             */
0140:            public Diff compareXML(String control, String test)
0141:                    throws SAXException, IOException {
0142:                return XMLUnit.compareXML(control, test);
0143:            }
0144:
0145:            /**
0146:             * Compare two XML documents provided as strings
0147:             * @param control Control document
0148:             * @param test Document to test
0149:             * @return Diff object describing differences in documents
0150:             */
0151:            public Diff compareXML(Document control, Document test) {
0152:                return XMLUnit.compareXML(control, test);
0153:            }
0154:
0155:            /**
0156:             * Assert that the result of an XML comparison is or is not similar.
0157:             * @param diff the result of an XML comparison
0158:             * @param assertion true if asserting that result is similar
0159:             */
0160:            public void assertXMLEqual(Diff diff, boolean assertion) {
0161:                XMLAssert.assertXMLEqual(diff, assertion);
0162:            }
0163:
0164:            /**
0165:             * Assert that the result of an XML comparison is or is not similar.
0166:             * @param msg additional message to display if assertion fails
0167:             * @param diff the result of an XML comparison
0168:             * @param assertion true if asserting that result is similar
0169:             */
0170:            public void assertXMLEqual(String msg, Diff diff, boolean assertion) {
0171:                XMLAssert.assertXMLEqual(msg, diff, assertion);
0172:            }
0173:
0174:            /**
0175:             * Assert that the result of an XML comparison is or is not identical
0176:             * @param diff the result of an XML comparison
0177:             * @param assertion true if asserting that result is identical
0178:             */
0179:            public void assertXMLIdentical(Diff diff, boolean assertion) {
0180:                XMLAssert.assertXMLIdentical(diff.toString(), diff, assertion);
0181:            }
0182:
0183:            /**
0184:             * Assert that the result of an XML comparison is or is not identical
0185:             * @param msg Message to display if assertion fails
0186:             * @param diff the result of an XML comparison
0187:             * @param assertion true if asserting that result is identical
0188:             */
0189:            public void assertXMLIdentical(String msg, Diff diff,
0190:                    boolean assertion) {
0191:                XMLAssert.assertXMLIdentical(msg, diff, assertion);
0192:            }
0193:
0194:            /**
0195:             * Assert that two XML documents are similar
0196:             * @param control XML to be compared against
0197:             * @param test XML to be tested
0198:             * @throws SAXException
0199:             * @throws IOException
0200:             */
0201:            public void assertXMLEqual(InputSource control, InputSource test)
0202:                    throws SAXException, IOException {
0203:                XMLAssert.assertXMLEqual(control, test);
0204:            }
0205:
0206:            /**
0207:             * Assert that two XML documents are similar
0208:             * @param control XML to be compared against
0209:             * @param test XML to be tested
0210:             * @throws SAXException
0211:             * @throws IOException
0212:             */
0213:            public void assertXMLEqual(String control, String test)
0214:                    throws SAXException, IOException {
0215:                XMLAssert.assertXMLEqual(control, test);
0216:            }
0217:
0218:            /**
0219:             * Assert that two XML documents are similar
0220:             * @param control XML to be compared against
0221:             * @param test XML to be tested
0222:             */
0223:            public void assertXMLEqual(Document control, Document test) {
0224:                XMLAssert.assertXMLEqual(control, test);
0225:            }
0226:
0227:            /**
0228:             * Assert that two XML documents are similar
0229:             * @param control XML to be compared against
0230:             * @param test XML to be tested
0231:             * @throws SAXException
0232:             * @throws IOException
0233:             */
0234:            public void assertXMLEqual(Reader control, Reader test)
0235:                    throws SAXException, IOException {
0236:                XMLAssert.assertXMLEqual(control, test);
0237:            }
0238:
0239:            /**
0240:             * Assert that two XML documents are similar
0241:             * @param err Message to be displayed on assertion failure
0242:             * @param control XML to be compared against
0243:             * @param test XML to be tested
0244:             * @throws SAXException
0245:             * @throws IOException
0246:             */
0247:            public void assertXMLEqual(String err, String control, String test)
0248:                    throws SAXException, IOException {
0249:                XMLAssert.assertXMLEqual(err, control, test);
0250:            }
0251:
0252:            /**
0253:             * Assert that two XML documents are similar
0254:             * @param err Message to be displayed on assertion failure
0255:             * @param control XML to be compared against
0256:             * @param test XML to be tested
0257:             * @throws SAXException
0258:             * @throws IOException
0259:             */
0260:            public void assertXMLEqual(String err, InputSource control,
0261:                    InputSource test) throws SAXException, IOException {
0262:                XMLAssert.assertXMLEqual(err, control, test);
0263:            }
0264:
0265:            /**
0266:             * Assert that two XML documents are similar
0267:             * @param err Message to be displayed on assertion failure
0268:             * @param control XML to be compared against
0269:             * @param test XML to be tested
0270:             */
0271:            public void assertXMLEqual(String err, Document control,
0272:                    Document test) {
0273:                XMLAssert.assertXMLEqual(err, control, test);
0274:            }
0275:
0276:            /**
0277:             * Assert that two XML documents are similar
0278:             * @param err Message to be displayed on assertion failure
0279:             * @param control XML to be compared against
0280:             * @param test XML to be tested
0281:             * @throws SAXException
0282:             * @throws IOException
0283:             */
0284:            public void assertXMLEqual(String err, Reader control, Reader test)
0285:                    throws SAXException, IOException {
0286:                XMLAssert.assertXMLEqual(err, control, test);
0287:            }
0288:
0289:            /**
0290:             * Assert that two XML documents are NOT similar
0291:             * @param control XML to be compared against
0292:             * @param test XML to be tested
0293:             * @throws SAXException
0294:             * @throws IOException
0295:             */
0296:            public void assertXMLNotEqual(InputSource control, InputSource test)
0297:                    throws SAXException, IOException {
0298:                XMLAssert.assertXMLNotEqual(control, test);
0299:            }
0300:
0301:            /**
0302:             * Assert that two XML documents are NOT similar
0303:             * @param control XML to be compared against
0304:             * @param test XML to be tested
0305:             * @throws SAXException
0306:             * @throws IOException
0307:             */
0308:            public void assertXMLNotEqual(String control, String test)
0309:                    throws SAXException, IOException {
0310:                XMLAssert.assertXMLNotEqual(control, test);
0311:            }
0312:
0313:            /**
0314:             * Assert that two XML documents are NOT similar
0315:             * @param control XML to be compared against
0316:             * @param test XML to be tested
0317:             */
0318:            public void assertXMLNotEqual(Document control, Document test) {
0319:                XMLAssert.assertXMLNotEqual(control, test);
0320:            }
0321:
0322:            /**
0323:             * Assert that two XML documents are NOT similar
0324:             * @param control XML to be compared against
0325:             * @param test XML to be tested
0326:             * @throws SAXException
0327:             * @throws IOException
0328:             */
0329:            public void assertXMLNotEqual(Reader control, Reader test)
0330:                    throws SAXException, IOException {
0331:                XMLAssert.assertXMLNotEqual(control, test);
0332:            }
0333:
0334:            /**
0335:             * Assert that two XML documents are NOT similar
0336:             * @param err Message to be displayed on assertion failure
0337:             * @param control XML to be compared against
0338:             * @param test XML to be tested
0339:             * @throws SAXException
0340:             * @throws IOException
0341:             */
0342:            public void assertXMLNotEqual(String err, InputSource control,
0343:                    InputSource test) throws SAXException, IOException {
0344:                XMLAssert.assertXMLNotEqual(err, control, test);
0345:            }
0346:
0347:            /**
0348:             * Assert that two XML documents are NOT similar
0349:             * @param err Message to be displayed on assertion failure
0350:             * @param control XML to be compared against
0351:             * @param test XML to be tested
0352:             * @throws SAXException
0353:             * @throws IOException
0354:             */
0355:            public void assertXMLNotEqual(String err, String control,
0356:                    String test) throws SAXException, IOException {
0357:                XMLAssert.assertXMLNotEqual(err, control, test);
0358:            }
0359:
0360:            /**
0361:             * Assert that two XML documents are NOT similar
0362:             * @param err Message to be displayed on assertion failure
0363:             * @param control XML to be compared against
0364:             * @param test XML to be tested
0365:             */
0366:            public void assertXMLNotEqual(String err, Document control,
0367:                    Document test) {
0368:                XMLAssert.assertXMLNotEqual(err, control, test);
0369:            }
0370:
0371:            /**
0372:             * Assert that two XML documents are NOT similar
0373:             * @param err Message to be displayed on assertion failure
0374:             * @param control XML to be compared against
0375:             * @param test XML to be tested
0376:             * @throws SAXException
0377:             * @throws IOException
0378:             */
0379:            public void assertXMLNotEqual(String err, Reader control,
0380:                    Reader test) throws SAXException, IOException {
0381:                XMLAssert.assertXMLNotEqual(err, control, test);
0382:            }
0383:
0384:            /**
0385:             * Assert that the node lists of two Xpaths in the same document are equal
0386:             * @param xpathOne
0387:             * @param xpathTwo
0388:             * @param document
0389:             * @see XpathEngine
0390:             */
0391:            public void assertXpathsEqual(String controlXpath,
0392:                    String testXpath, InputSource document)
0393:                    throws SAXException, IOException, XpathException {
0394:                XMLAssert.assertXpathsEqual(controlXpath, testXpath, document);
0395:            }
0396:
0397:            /**
0398:             * Assert that the node lists of two Xpaths in the same document are equal
0399:             * @param xpathOne
0400:             * @param xpathTwo
0401:             * @param document
0402:             * @see XpathEngine
0403:             */
0404:            public void assertXpathsEqual(String controlXpath,
0405:                    String testXpath, Document document) throws XpathException {
0406:                XMLAssert.assertXpathsEqual(controlXpath, testXpath, document);
0407:            }
0408:
0409:            /**
0410:             * Assert that the node lists of two Xpaths in the same XML string are
0411:             * equal
0412:             * @param xpathOne
0413:             * @param xpathTwo
0414:             * @param inXMLString
0415:             * @throws SAXException
0416:             * @throws IOException
0417:             */
0418:            public void assertXpathsEqual(String controlXpath,
0419:                    String testXpath, String inXMLString) throws SAXException,
0420:                    IOException, XpathException {
0421:                XMLAssert.assertXpathsEqual(controlXpath, testXpath,
0422:                        inXMLString);
0423:            }
0424:
0425:            /**
0426:             * Assert that the node lists of two Xpaths in two XML pieces are equal
0427:             * @param xpathOne
0428:             * @param control
0429:             * @param xpathTwo
0430:             * @param test
0431:             * @throws SAXException
0432:             * @throws IOException
0433:             */
0434:            public void assertXpathsEqual(String controlXpath,
0435:                    InputSource control, String testXpath, InputSource test)
0436:                    throws SAXException, IOException, XpathException {
0437:                XMLAssert.assertXpathsEqual(controlXpath, control, testXpath,
0438:                        test);
0439:            }
0440:
0441:            /**
0442:             * Assert that the node lists of two Xpaths in two XML strings are equal
0443:             * @param xpathOne
0444:             * @param inControlXMLString
0445:             * @param xpathTwo
0446:             * @param inTestXMLString
0447:             * @throws SAXException
0448:             * @throws IOException
0449:             */
0450:            public void assertXpathsEqual(String controlXpath,
0451:                    String inControlXMLString, String testXpath,
0452:                    String inTestXMLString) throws SAXException, IOException,
0453:                    XpathException {
0454:                XMLAssert.assertXpathsEqual(controlXpath, inControlXMLString,
0455:                        testXpath, inTestXMLString);
0456:            }
0457:
0458:            /**
0459:             * Assert that the node lists of two Xpaths in two documents are equal
0460:             * @param xpathOne
0461:             * @param xpathTwo
0462:             * @param document
0463:             * @see XpathEngine
0464:             */
0465:            public void assertXpathsEqual(String controlXpath,
0466:                    Document controlDocument, String testXpath,
0467:                    Document testDocument) throws XpathException {
0468:                XMLAssert.assertXpathsEqual(controlXpath, controlDocument,
0469:                        testXpath, testDocument);
0470:            }
0471:
0472:            /**
0473:             * Assert that the node lists of two Xpaths in the same document are NOT equal
0474:             * @param xpathOne
0475:             * @param xpathTwo
0476:             * @param document
0477:             * @see XpathEngine
0478:             */
0479:            public void assertXpathsNotEqual(String controlXpath,
0480:                    String testXpath, Document document) throws XpathException {
0481:                XMLAssert.assertXpathsNotEqual(controlXpath, testXpath,
0482:                        document);
0483:            }
0484:
0485:            /**
0486:             * Assert that the node lists of two Xpaths in the same XML are NOT
0487:             * equal
0488:             * @param xpathOne
0489:             * @param xpathTwo
0490:             * @param control
0491:             * @throws SAXException
0492:             * @throws IOException
0493:             */
0494:            public void assertXpathsNotEqual(String controlXpath,
0495:                    String testXpath, InputSource control) throws SAXException,
0496:                    IOException, XpathException {
0497:                XMLAssert
0498:                        .assertXpathsNotEqual(controlXpath, testXpath, control);
0499:            }
0500:
0501:            /**
0502:             * Assert that the node lists of two Xpaths in the same XML string are NOT
0503:             * equal
0504:             * @param xpathOne
0505:             * @param xpathTwo
0506:             * @param inXMLString
0507:             * @throws SAXException
0508:             * @throws IOException
0509:             */
0510:            public void assertXpathsNotEqual(String controlXpath,
0511:                    String testXpath, String inXMLString) throws SAXException,
0512:                    IOException, XpathException {
0513:                XMLAssert.assertXpathsNotEqual(controlXpath, testXpath,
0514:                        inXMLString);
0515:            }
0516:
0517:            /**
0518:             * Assert that the node lists of two Xpaths in two pieces of XML
0519:             * are NOT equal
0520:             * @param xpathOne
0521:             * @param control
0522:             * @param xpathTwo
0523:             * @param test
0524:             * @throws SAXException
0525:             * @throws IOException
0526:             */
0527:            public void assertXpathsNotEqual(String controlXpath,
0528:                    InputSource control, String testXpath, InputSource test)
0529:                    throws SAXException, IOException, XpathException {
0530:                XMLAssert.assertXpathsNotEqual(controlXpath, control,
0531:                        testXpath, test);
0532:            }
0533:
0534:            /**
0535:             * Assert that the node lists of two Xpaths in two XML strings are NOT equal
0536:             * @param xpathOne
0537:             * @param inControlXMLString
0538:             * @param xpathTwo
0539:             * @param inTestXMLString
0540:             * @throws SAXException
0541:             * @throws IOException
0542:             */
0543:            public void assertXpathsNotEqual(String controlXpath,
0544:                    String inControlXMLString, String testXpath,
0545:                    String inTestXMLString) throws SAXException, IOException,
0546:                    XpathException {
0547:                XMLAssert.assertXpathsNotEqual(controlXpath,
0548:                        inControlXMLString, testXpath, inTestXMLString);
0549:            }
0550:
0551:            /**
0552:             * Assert that the node lists of two Xpaths in two documents are NOT equal
0553:             * @param xpathOne
0554:             * @param xpathTwo
0555:             * @param document
0556:             * @see XpathEngine
0557:             */
0558:            public void assertXpathsNotEqual(String controlXpath,
0559:                    Document controlDocument, String testXpath,
0560:                    Document testDocument) throws XpathException {
0561:                XMLAssert.assertXpathsNotEqual(controlXpath, controlDocument,
0562:                        testXpath, testDocument);
0563:            }
0564:
0565:            /**
0566:             * Assert that the evaluation of two Xpaths in the same document are equal
0567:             * @param xpathOne
0568:             * @param xpathTwo
0569:             * @param document
0570:             * @see XpathEngine
0571:             */
0572:            public void assertXpathValuesEqual(String controlXpath,
0573:                    String testXpath, Document document) throws XpathException {
0574:                XMLAssert.assertXpathValuesEqual(controlXpath, testXpath,
0575:                        document);
0576:            }
0577:
0578:            /**
0579:             * Assert that the evaluation of two Xpaths in the same XML are
0580:             *  equal
0581:             * @param xpathOne
0582:             * @param xpathTwo
0583:             * @param control
0584:             * @throws SAXException
0585:             * @throws IOException
0586:             */
0587:            public void assertXpathValuesEqual(String controlXpath,
0588:                    String testXpath, InputSource control) throws SAXException,
0589:                    IOException, XpathException {
0590:                XMLAssert.assertXpathValuesEqual(controlXpath, testXpath,
0591:                        control);
0592:            }
0593:
0594:            /**
0595:             * Assert that the evaluation of two Xpaths in the same XML string are
0596:             *  equal
0597:             * @param xpathOne
0598:             * @param xpathTwo
0599:             * @param inXMLString
0600:             * @throws SAXException
0601:             * @throws IOException
0602:             */
0603:            public void assertXpathValuesEqual(String controlXpath,
0604:                    String testXpath, String inXMLString) throws SAXException,
0605:                    IOException, XpathException {
0606:                XMLAssert.assertXpathValuesEqual(controlXpath, testXpath,
0607:                        inXMLString);
0608:            }
0609:
0610:            /**
0611:             * Assert that the evaluation of two Xpaths in two XML strings are equal
0612:             * @param xpathOne
0613:             * @param control
0614:             * @param xpathTwo
0615:             * @param test
0616:             * @throws SAXException
0617:             * @throws IOException
0618:             */
0619:            public void assertXpathValuesEqual(String controlXpath,
0620:                    InputSource control, String testXpath, InputSource test)
0621:                    throws SAXException, IOException, XpathException {
0622:                XMLAssert.assertXpathValuesEqual(controlXpath, control,
0623:                        testXpath, test);
0624:            }
0625:
0626:            /**
0627:             * Assert that the evaluation of two Xpaths in two XML strings are equal
0628:             * @param xpathOne
0629:             * @param inControlXMLString
0630:             * @param xpathTwo
0631:             * @param inTestXMLString
0632:             * @throws SAXException
0633:             * @throws IOException
0634:             */
0635:            public void assertXpathValuesEqual(String controlXpath,
0636:                    String inControlXMLString, String testXpath,
0637:                    String inTestXMLString) throws SAXException, IOException,
0638:                    XpathException {
0639:                XMLAssert.assertXpathValuesEqual(controlXpath,
0640:                        inControlXMLString, testXpath, inTestXMLString);
0641:            }
0642:
0643:            /**
0644:             * Assert that the evaluation of two Xpaths in two documents are equal
0645:             * @param xpathOne
0646:             * @param xpathTwo
0647:             * @param document
0648:             * @see XpathEngine
0649:             */
0650:            public void assertXpathValuesEqual(String controlXpath,
0651:                    Document controlDocument, String testXpath,
0652:                    Document testDocument) throws XpathException {
0653:                XMLAssert.assertXpathValuesEqual(controlXpath, controlDocument,
0654:                        testXpath, testDocument);
0655:            }
0656:
0657:            /**
0658:             * Assert that the evaluation of two Xpaths in the same XML string are
0659:             * NOT equal
0660:             * @param xpathOne
0661:             * @param xpathTwo
0662:             * @param control
0663:             * @throws SAXException
0664:             * @throws IOException
0665:             */
0666:            public void assertXpathValuesNotEqual(String controlXpath,
0667:                    String testXpath, InputSource control) throws SAXException,
0668:                    IOException, XpathException {
0669:                XMLAssert.assertXpathValuesNotEqual(controlXpath, testXpath,
0670:                        control);
0671:            }
0672:
0673:            /**
0674:             * Assert that the evaluation of two Xpaths in the same XML string are
0675:             * NOT equal
0676:             * @param xpathOne
0677:             * @param xpathTwo
0678:             * @param inXMLString
0679:             * @throws SAXException
0680:             * @throws IOException
0681:             */
0682:            public void assertXpathValuesNotEqual(String controlXpath,
0683:                    String testXpath, String inXMLString) throws SAXException,
0684:                    IOException, XpathException {
0685:                XMLAssert.assertXpathValuesNotEqual(controlXpath, testXpath,
0686:                        inXMLString);
0687:            }
0688:
0689:            /**
0690:             * Assert that the evaluation of two Xpaths in the same document are
0691:             * NOT equal
0692:             * @param xpathOne
0693:             * @param xpathTwo
0694:             * @param document
0695:             */
0696:            public void assertXpathValuesNotEqual(String controlXpath,
0697:                    String testXpath, Document document) throws XpathException {
0698:                XMLAssert.assertXpathValuesNotEqual(controlXpath, testXpath,
0699:                        document);
0700:            }
0701:
0702:            /**
0703:             * Assert that the evaluation of two Xpaths in two XML strings are
0704:             * NOT equal
0705:             * @param xpathOne
0706:             * @param control
0707:             * @param xpathTwo
0708:             * @param test
0709:             * @throws SAXException
0710:             * @throws IOException
0711:             */
0712:            public void assertXpathValuesNotEqual(String controlXpath,
0713:                    InputSource control, String testXpath, InputSource test)
0714:                    throws SAXException, IOException, XpathException {
0715:                XMLAssert.assertXpathValuesNotEqual(controlXpath, control,
0716:                        testXpath, test);
0717:            }
0718:
0719:            /**
0720:             * Assert that the evaluation of two Xpaths in two XML strings are
0721:             * NOT equal
0722:             * @param xpathOne
0723:             * @param inControlXMLString
0724:             * @param xpathTwo
0725:             * @param inTestXMLString
0726:             * @throws SAXException
0727:             * @throws IOException
0728:             */
0729:            public void assertXpathValuesNotEqual(String controlXpath,
0730:                    String inControlXMLString, String testXpath,
0731:                    String inTestXMLString) throws SAXException, IOException,
0732:                    XpathException {
0733:                XMLAssert.assertXpathValuesNotEqual(controlXpath,
0734:                        inControlXMLString, testXpath, inTestXMLString);
0735:            }
0736:
0737:            /**
0738:             * Assert that the evaluation of two Xpaths in two documents are
0739:             * NOT equal
0740:             * @param xpathOne
0741:             * @param xpathTwo
0742:             * @param document
0743:             */
0744:            public void assertXpathValuesNotEqual(String controlXpath,
0745:                    Document controlDocument, String testXpath,
0746:                    Document testDocument) throws XpathException {
0747:                XMLAssert.assertXpathValuesNotEqual(controlXpath,
0748:                        controlDocument, testXpath, testDocument);
0749:            }
0750:
0751:            /**
0752:             * Assert the value of an Xpath expression in an XML String
0753:             * @param expectedValue
0754:             * @param xpathExpression
0755:             * @param control
0756:             * @throws SAXException
0757:             * @throws IOException
0758:             * @see XpathEngine which provides the underlying evaluation mechanism
0759:             */
0760:            public void assertXpathEvaluatesTo(String expectedValue,
0761:                    String xpathExpression, InputSource control)
0762:                    throws SAXException, IOException, XpathException {
0763:                XMLAssert.assertXpathEvaluatesTo(expectedValue,
0764:                        xpathExpression, control);
0765:            }
0766:
0767:            /**
0768:             * Assert the value of an Xpath expression in an XML String
0769:             * @param expectedValue
0770:             * @param xpathExpression
0771:             * @param inXMLString
0772:             * @throws SAXException
0773:             * @throws IOException
0774:             * @see XpathEngine which provides the underlying evaluation mechanism
0775:             */
0776:            public void assertXpathEvaluatesTo(String expectedValue,
0777:                    String xpathExpression, String inXMLString)
0778:                    throws SAXException, IOException, XpathException {
0779:                XMLAssert.assertXpathEvaluatesTo(expectedValue,
0780:                        xpathExpression, inXMLString);
0781:            }
0782:
0783:            /**
0784:             * Assert the value of an Xpath expression in an DOM Document
0785:             * @param expectedValue
0786:             * @param xpathExpression
0787:             * @param inDocument
0788:             * @param ctx
0789:             * @see XpathEngine which provides the underlying evaluation mechanism
0790:             */
0791:            public void assertXpathEvaluatesTo(String expectedValue,
0792:                    String xpathExpression, Document inDocument)
0793:                    throws XpathException {
0794:                XMLAssert.assertXpathEvaluatesTo(expectedValue,
0795:                        xpathExpression, inDocument);
0796:            }
0797:
0798:            /**
0799:             * Assert that a specific XPath exists in some given XML
0800:             * @param inXpathExpression
0801:             * @param xml
0802:             * @see XpathEngine which provides the underlying evaluation mechanism
0803:             */
0804:            public void assertXpathExists(String xPathExpression,
0805:                    InputSource xml) throws IOException, SAXException,
0806:                    XpathException {
0807:                XMLAssert.assertXpathExists(xPathExpression, xml);
0808:            }
0809:
0810:            /**
0811:             * Assert that a specific XPath exists in some given XML
0812:             * @param inXpathExpression
0813:             * @param inXMLString
0814:             * @see XpathEngine which provides the underlying evaluation mechanism
0815:             */
0816:            public void assertXpathExists(String xPathExpression,
0817:                    String inXMLString) throws IOException, SAXException,
0818:                    XpathException {
0819:                XMLAssert.assertXpathExists(xPathExpression, inXMLString);
0820:            }
0821:
0822:            /**
0823:             * Assert that a specific XPath exists in some given XML
0824:             * @param inXpathExpression
0825:             * @param inDocument
0826:             * @param ctx
0827:             * @see XpathEngine which provides the underlying evaluation mechanism
0828:             */
0829:            public void assertXpathExists(String xPathExpression,
0830:                    Document inDocument) throws XpathException {
0831:                XMLAssert.assertXpathExists(xPathExpression, inDocument);
0832:            }
0833:
0834:            /**
0835:             * Assert that a specific XPath does NOT exist in some given XML
0836:             * @param inXpathExpression
0837:             * @param xml
0838:             * @see XpathEngine which provides the underlying evaluation mechanism
0839:             */
0840:            public void assertXpathNotExists(String xPathExpression,
0841:                    InputSource xml) throws IOException, SAXException,
0842:                    XpathException {
0843:                XMLAssert.assertXpathNotExists(xPathExpression, xml);
0844:            }
0845:
0846:            /**
0847:             * Assert that a specific XPath does NOT exist in some given XML
0848:             * @param inXpathExpression
0849:             * @param inXMLString
0850:             * @see XpathEngine which provides the underlying evaluation mechanism
0851:             */
0852:            public void assertXpathNotExists(String xPathExpression,
0853:                    String inXMLString) throws IOException, SAXException,
0854:                    XpathException {
0855:                XMLAssert.assertXpathNotExists(xPathExpression, inXMLString);
0856:            }
0857:
0858:            /**
0859:             * Assert that a specific XPath does NOT exist in some given XML
0860:             * @param inXpathExpression
0861:             * @param inDocument
0862:             * @see XpathEngine which provides the underlying evaluation mechanism
0863:             */
0864:            public void assertXpathNotExists(String xPathExpression,
0865:                    Document inDocument) throws XpathException {
0866:                XMLAssert.assertXpathNotExists(xPathExpression, inDocument);
0867:            }
0868:
0869:            /**
0870:             * Assert that a piece of XML contains valid XML: the input must
0871:             * contain a DOCTYPE declaration to be validated
0872:             * @param xml
0873:             * @throws SAXException
0874:             * @throws ConfigurationException if validation could not be turned on
0875:             * @see Validator
0876:             */
0877:            public void assertXMLValid(InputSource xml) throws SAXException,
0878:                    ConfigurationException {
0879:                XMLAssert.assertXMLValid(xml);
0880:            }
0881:
0882:            /**
0883:             * Assert that a String containing XML contains valid XML: the String must
0884:             * contain a DOCTYPE declaration to be validated
0885:             * @param xmlString
0886:             * @throws SAXException
0887:             * @throws ConfigurationException if validation could not be turned on
0888:             * @see Validator
0889:             */
0890:            public void assertXMLValid(String xmlString) throws SAXException,
0891:                    ConfigurationException {
0892:                XMLAssert.assertXMLValid(xmlString);
0893:            }
0894:
0895:            /**
0896:             * Assert that a piece of XML contains valid XML: the document must
0897:             * contain a DOCTYPE to be validated, but the validation will use the
0898:             * systemId to obtain the DTD
0899:             * @param xml
0900:             * @param systemId
0901:             * @throws SAXException
0902:             * @throws ConfigurationException if validation could not be turned on
0903:             * @see Validator
0904:             */
0905:            public void assertXMLValid(InputSource xml, String systemId)
0906:                    throws SAXException, ConfigurationException {
0907:                XMLAssert.assertXMLValid(xml, systemId);
0908:            }
0909:
0910:            /**
0911:             * Assert that a String containing XML contains valid XML: the String must
0912:             * contain a DOCTYPE to be validated, but the validation will use the
0913:             * systemId to obtain the DTD
0914:             * @param xmlString
0915:             * @param systemId
0916:             * @throws SAXException
0917:             * @throws ConfigurationException if validation could not be turned on
0918:             * @see Validator
0919:             */
0920:            public void assertXMLValid(String xmlString, String systemId)
0921:                    throws SAXException, ConfigurationException {
0922:                XMLAssert.assertXMLValid(xmlString, systemId);
0923:            }
0924:
0925:            /**
0926:             * Assert that a piece of XML contains valid XML: the document
0927:             * will be given a DOCTYPE to be validated with the name and
0928:             * systemId specified regardless of whether it already contains a
0929:             * doctype declaration.
0930:             * @param xml
0931:             * @param systemId
0932:             * @param doctype
0933:             * @throws SAXException
0934:             * @throws ConfigurationException if validation could not be turned on
0935:             * @see Validator
0936:             */
0937:            public void assertXMLValid(InputSource xml, String systemId,
0938:                    String doctype) throws SAXException, ConfigurationException {
0939:                XMLAssert.assertXMLValid(xml, systemId, doctype);
0940:            }
0941:
0942:            /**
0943:             * Assert that a String containing XML contains valid XML: the String will
0944:             * be given a DOCTYPE to be validated with the name and systemId specified
0945:             * regardless of whether it already contains a doctype declaration.
0946:             * @param xmlString
0947:             * @param systemId
0948:             * @param doctype
0949:             * @throws SAXException
0950:             * @throws ConfigurationException if validation could not be turned on
0951:             * @see Validator
0952:             */
0953:            public void assertXMLValid(String xmlString, String systemId,
0954:                    String doctype) throws SAXException, ConfigurationException {
0955:                XMLAssert.assertXMLValid(xmlString, systemId, doctype);
0956:            }
0957:
0958:            /**
0959:             * Assert that a Validator instance returns <code>isValid() == true</code>
0960:             * @param validator
0961:             */
0962:            public void assertXMLValid(Validator validator) {
0963:                XMLAssert.assertXMLValid(validator);
0964:            }
0965:
0966:            /**
0967:             * Execute a <code>NodeTest<code> for a single node type
0968:             * and assert that it passes
0969:             * @param xml XML to be tested
0970:             * @param tester The test strategy
0971:             * @param nodeType The node type to be tested: constants defined
0972:             *  in {@link Node org.w3c.dom.Node} e.g. <code>Node.ELEMENT_NODE</code>
0973:             * @throws SAXException
0974:             * @throws IOException
0975:             * @see AbstractNodeTester
0976:             * @see CountingNodeTester
0977:             */
0978:            public void assertNodeTestPasses(InputSource xml,
0979:                    NodeTester tester, short nodeType) throws SAXException,
0980:                    IOException {
0981:                XMLAssert.assertNodeTestPasses(xml, tester, nodeType);
0982:            }
0983:
0984:            /**
0985:             * Execute a <code>NodeTest<code> for a single node type
0986:             * and assert that it passes
0987:             * @param xmlString XML to be tested
0988:             * @param tester The test strategy
0989:             * @param nodeType The node type to be tested: constants defined
0990:             *  in {@link Node org.w3c.dom.Node} e.g. <code>Node.ELEMENT_NODE</code>
0991:             * @throws SAXException
0992:             * @throws IOException
0993:             * @see AbstractNodeTester
0994:             * @see CountingNodeTester
0995:             */
0996:            public void assertNodeTestPasses(String xmlString,
0997:                    NodeTester tester, short nodeType) throws SAXException,
0998:                    IOException {
0999:                XMLAssert.assertNodeTestPasses(xmlString, tester, nodeType);
1000:            }
1001:
1002:            /**
1003:             * Execute a <code>NodeTest<code> for multiple node types and make an
1004:             * assertion about it whether it is expected to pass
1005:             * @param test a NodeTest instance containing the XML source to be tested
1006:             * @param tester The test strategy
1007:             * @param nodeTypes The node types to be tested: constants defined
1008:             *  in {@link Node org.w3c.dom.Node} e.g. <code>Node.ELEMENT_NODE</code>
1009:             * @param assertion true if the test is expected to pass, false otherwise
1010:             * @see AbstractNodeTester
1011:             * @see CountingNodeTester
1012:             */
1013:            public void assertNodeTestPasses(NodeTest test, NodeTester tester,
1014:                    short[] nodeTypes, boolean assertion) {
1015:                XMLAssert.assertNodeTestPasses(test, tester, nodeTypes,
1016:                        assertion);
1017:            }
1018:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.