3 This Java source file was generated by test-to-java.xsl
4 and is a derived work from the source document.
5 The source document contained the following notice:
8 Copyright (c) 2001 World Wide Web Consortium,
9 (Massachusetts Institute of Technology, Institut National de
10 Recherche en Informatique et en Automatique, Keio University). All
11 Rights Reserved. This program is distributed under the W3C's Software
12 Intellectual Property License. This program is distributed in the
13 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
20 package org.w3c.domts.level1.core;
25 import org.w3c.domts.DOMTestCase;
26 import org.w3c.domts.DOMTestDocumentBuilderFactory;
31 * On successful invocation of the "deleteData(offset,count)"
32 * method, the "getData()" and "getLength()" methods reflect
35 * Retrieve the character data from the last child of the
36 * first employee. The "deleteData(offset,count)"
37 * method is then called with offset=30 and count=5.
38 * The method should delete the characters from position
39 * 30 thru position 35. The new value of the character data
40 * should be "1230 North Ave. Dallas, Texas" which is
41 * returned by the "getData()" method and "getLength()"
42 * method should return 30".
45 * @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
46 * @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C</a>
47 * @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
49 public final class characterdatadeletedatagetlengthanddata extends DOMTestCase {
53 * @param factory document factory, may not be null
54 * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
56 public characterdatadeletedatagetlengthanddata(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException {
60 // check if loaded documents are supported for content type
62 String contentType = getContentType();
63 preload(contentType, "staff", true);
68 * @throws Throwable Any uncaught exception causes test to fail
70 public void runTest() throws Throwable {
77 java.util.List result = new java.util.ArrayList();
79 doc = (Document) load("staff", true);
80 elementList = doc.getElementsByTagName("address");
81 nameNode = elementList.item(0);
82 child = (CharacterData) nameNode.getFirstChild();
83 child.deleteData(30, 5);
84 childData = child.getData();
85 assertEquals("data", "1230 North Ave. Dallas, Texas ", childData);
86 childLength = (int) child.getLength();
87 assertEquals("length", 30, childLength);
90 * Gets URI that identifies the test.
91 * @return uri identifier of test
93 public String getTargetURI() {
94 return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatagetlengthanddata";
97 * Runs this test from the command line.
98 * @param args command line arguments
100 public static void main(final String[] args) {
101 DOMTestCase.doMain(characterdatadeletedatagetlengthanddata.class, args);