Public Methods | |
| nodereplacechildnewchildexists (DOMTestDocumentBuilderFactory factory) | |
| void | runTest () throws java.lang.Throwable |
| String | getTargetURI () |
Static Public Methods | |
| void | main (String[] args) |
Retrieve the second employee and replace its TWELFTH child(address) with its SECOND child(employeeId). After the replacement the second child should now be the one that used to be at the third position and the TWELFTH child should be the one that used to be at the SECOND position.
Definition at line 46 of file nodereplacechildnewchildexists.java.
|
|
Definition at line 48 of file nodereplacechildnewchildexists.java.
00049 {
00050 super(factory);
00051
00052 }
|
|
|
Reimplemented from DOMTest. Definition at line 123 of file nodereplacechildnewchildexists.java.
00123 {
00124 return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnewchildexists";
00125 }
|
|
|
Definition at line 126 of file nodereplacechildnewchildexists.java. References DOMTestCase::doMain().
00126 {
00127 DOMTestCase.doMain(nodereplacechildnewchildexists.class,args);
00128 }
|
|
|
Reimplemented from DOMTestCase. Definition at line 54 of file nodereplacechildnewchildexists.java. References DOMTestCase::assertEquals(), DOMTestCase::assertSame(), DOMTest::isIgnoringElementContentWhitespace(), and DOMTest::load().
00054 {
00055 Document doc;
00056 NodeList elementList;
00057 Node employeeNode;
00058 NodeList childList;
00059 Node oldChild = null;
00060
00061 Node newChild = null;
00062
00063 Node child;
00064 String childName;
00065 Node childNode;
00066 List actual = new ArrayList();
00067
00068 List expected = new ArrayList();
00069
00070 List expectedWithoutWhitespace = new ArrayList();
00071 expectedWithoutWhitespace.add("name");
00072 expectedWithoutWhitespace.add("position");
00073 expectedWithoutWhitespace.add("salary");
00074 expectedWithoutWhitespace.add("gender");
00075 expectedWithoutWhitespace.add("employeeId");
00076
00077 List expectedWithWhitespace = new ArrayList();
00078 expectedWithWhitespace.add("#text");
00079 expectedWithWhitespace.add("#text");
00080 expectedWithWhitespace.add("name");
00081 expectedWithWhitespace.add("#text");
00082 expectedWithWhitespace.add("position");
00083 expectedWithWhitespace.add("#text");
00084 expectedWithWhitespace.add("salary");
00085 expectedWithWhitespace.add("#text");
00086 expectedWithWhitespace.add("gender");
00087 expectedWithWhitespace.add("#text");
00088 expectedWithWhitespace.add("employeeId");
00089 expectedWithWhitespace.add("#text");
00090
00091 Node replacedChild;
00092 doc = load("staff");
00093 elementList = doc.getElementsByTagName("employee");
00094 employeeNode = elementList.item(1);
00095 childList = employeeNode.getChildNodes();
00096
00097 if(
00098 !isIgnoringElementContentWhitespace()
00099 ) {
00100 newChild = childList.item(1);
00101 oldChild = childList.item(11);
00102 expected = expectedWithWhitespace;
00103
00104 }
00105
00106 else {
00107 newChild = childList.item(0);
00108 oldChild = childList.item(5);
00109 expected = expectedWithoutWhitespace;
00110
00111 }
00112 replacedChild = employeeNode.replaceChild(newChild,oldChild);
00113 assertSame("return_value_same",oldChild,replacedChild);
00114 for(int _index = 0; _index < childList.getLength();_index++) {
00115 childNode = ( Node ) childList.item(_index);
00116 childName = childNode.getNodeName();
00117 actual.add(childName);
00118
00119 }
00120 assertEquals("childNames",expected,actual);
00121
00122 }
|
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001