Public Methods | |
| nodeinsertbeforenewchildexists (DOMTestDocumentBuilderFactory factory) | |
| void | runTest () throws java.lang.Throwable |
| String | getTargetURI () |
Static Public Methods | |
| void | main (String[] args) |
Insert a node Element ("employeeId") that is already present in the tree. The existing node should be removed first and the new one inserted. The node is inserted at a different position in the tree to assure that it was indeed inserted.
Definition at line 47 of file nodeinsertbeforenewchildexists.java.
|
|
Definition at line 49 of file nodeinsertbeforenewchildexists.java.
00050 {
00051 super(factory);
00052
00053 }
|
|
|
Reimplemented from DOMTest. Definition at line 124 of file nodeinsertbeforenewchildexists.java.
00124 {
00125 return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenewchildexists";
00126 }
|
|
|
Definition at line 127 of file nodeinsertbeforenewchildexists.java. References DOMTestCase::doMain().
00127 {
00128 DOMTestCase.doMain(nodeinsertbeforenewchildexists.class,args);
00129 }
|
|
|
Reimplemented from DOMTestCase. Definition at line 55 of file nodeinsertbeforenewchildexists.java. References DOMTestCase::assertEquals(), DOMTest::isIgnoringElementContentWhitespace(), and DOMTest::load().
00055 {
00056 Document doc;
00057 NodeList elementList;
00058 Node employeeNode;
00059 NodeList childList;
00060 Node refChild;
00061 Node newChild;
00062 Node child;
00063 String childName;
00064 Node insertedNode;
00065 List expectedWhitespace = new ArrayList();
00066 expectedWhitespace.add("#text");
00067 expectedWhitespace.add("#text");
00068 expectedWhitespace.add("name");
00069 expectedWhitespace.add("#text");
00070 expectedWhitespace.add("position");
00071 expectedWhitespace.add("#text");
00072 expectedWhitespace.add("salary");
00073 expectedWhitespace.add("#text");
00074 expectedWhitespace.add("gender");
00075 expectedWhitespace.add("#text");
00076 expectedWhitespace.add("employeeId");
00077 expectedWhitespace.add("address");
00078 expectedWhitespace.add("#text");
00079
00080 List expectedNoWhitespace = new ArrayList();
00081 expectedNoWhitespace.add("name");
00082 expectedNoWhitespace.add("position");
00083 expectedNoWhitespace.add("salary");
00084 expectedNoWhitespace.add("gender");
00085 expectedNoWhitespace.add("employeeId");
00086 expectedNoWhitespace.add("address");
00087
00088 List expected = new ArrayList();
00089
00090 List result = new ArrayList();
00091
00092 doc = load("staff");
00093 elementList = doc.getElementsByTagName("employee");
00094
00095 if(
00096 isIgnoringElementContentWhitespace()
00097 ) {
00098 expected = expectedNoWhitespace;
00099 employeeNode = elementList.item(0);
00100 childList = employeeNode.getChildNodes();
00101 refChild = childList.item(5);
00102 newChild = childList.item(0);
00103
00104 }
00105
00106 else {
00107 expected = expectedWhitespace;
00108 employeeNode = elementList.item(1);
00109 childList = employeeNode.getChildNodes();
00110 refChild = childList.item(11);
00111 newChild = childList.item(1);
00112
00113 }
00114 insertedNode = employeeNode.insertBefore(newChild,refChild);
00115 for(int _index = 0; _index < childList.getLength();_index++) {
00116 child = ( Node ) childList.item(_index);
00117 childName = child.getNodeName();
00118 result.add(childName);
00119
00120 }
00121 assertEquals("childNames",expected,result);
00122
00123 }
|
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001