1 package org.apache.commons.betwixt.xmlunit;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import junit.framework.AssertionFailedError;
20
21 /***
22 * Test harness which test xml unit
23 *
24 * @author Robert Burrell Donkin
25 * @version $Id: TestXmlTestCase.java,v 1.5 2004/02/28 13:38:37 yoavs Exp $
26 */
27 public class TestXmlTestCase extends XmlTestCase {
28
29 public TestXmlTestCase(String name) {
30 super(name);
31 }
32
33 public void testXMLUnit() throws Exception {
34 xmlAssertIsomorphicContent(
35 parseFile("src/test/org/apache/commons/betwixt/xmlunit/rss-example.xml"),
36 parseFile("src/test/org/apache/commons/betwixt/xmlunit/rss-example.xml"));
37 }
38
39 public void testXMLUnit2() throws Exception {
40 boolean failed = false;
41 try {
42 xmlAssertIsomorphicContent(
43 parseFile("src/test/org/apache/commons/betwixt/xmlunit/rss-example.xml"),
44 parseFile("src/test/org/apache/commons/betwixt/xmlunit/rss-example-morphed.xml"),
45 false);
46 failed = true;
47 } catch (AssertionFailedError er) {
48
49 }
50 if (failed) {
51 fail("Expected unit test to fail!");
52 }
53 }
54
55 public void testXMLUnit3() throws Exception {
56 boolean failed = false;
57 try {
58 xmlAssertIsomorphicContent(
59 parseFile("src/test/org/apache/commons/betwixt/xmlunit/rss-example.xml"),
60 parseFile("src/test/org/apache/commons/betwixt/xmlunit/rss-example-not.xml"));
61 failed = true;
62 } catch (AssertionFailedError er) {
63
64 }
65 if (failed) {
66 fail("Expected unit test to fail!");
67 }
68 }
69
70
71 public void testXMLUnit4() throws Exception {
72 xmlAssertIsomorphicContent(
73 parseFile("src/test/org/apache/commons/betwixt/xmlunit/rss-example.xml"),
74 parseFile("src/test/org/apache/commons/betwixt/xmlunit/rss-example-morphed.xml"),
75 true);
76 }
77
78
79 public void testXMLUnit5() throws Exception {
80 boolean failed = false;
81 try {
82 xmlAssertIsomorphicContent(
83 parseFile("src/test/org/apache/commons/betwixt/xmlunit/rss-example.xml"),
84 parseFile("src/test/org/apache/commons/betwixt/xmlunit/rss-example-not.xml"),
85 true);
86 failed = true;
87 } catch (AssertionFailedError er) {
88
89 }
90 if (failed) {
91 fail("Expected unit test to fail!");
92 }
93 }
94
95
96 public void testXMLUnit6() throws Exception {
97 boolean failed = false;
98 try {
99 xmlAssertIsomorphicContent(
100 parseFile("src/test/org/apache/commons/betwixt/xmlunit/scarab-one.xml"),
101 parseFile("src/test/org/apache/commons/betwixt/xmlunit/scarab-two.xml"),
102 true);
103 failed = true;
104 } catch (AssertionFailedError er) {
105
106 }
107 if (failed) {
108 fail("Expected unit test to fail!");
109 }
110 }
111 }