KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > zeus > util > DTDUtilsTest


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  */

19 package org.enhydra.zeus.util;
20
21 // JUnit imports
22
import junit.framework.Test;
23 import junit.framework.TestCase;
24 import junit.framework.TestSuite;
25
26 // DTDParser imports
27
import com.wutka.dtd.DTDElement;
28 import com.wutka.dtd.DTDName;
29 import com.wutka.dtd.DTDPCData;
30
31 /**
32  * <p>
33  * This is a test case for the <code>{@link DTDUtils}</code> class.
34  * </p>
35  *
36  * @author Brett McLaughlin
37  */

38 public class DTDUtilsTest extends TestCase {
39
40     /**
41      * <p>
42      * This constructs a new <code>DTDUtilsTest</code>.
43      * </p>
44      *
45      * @param name the name of the test case.
46      */

47     public DTDUtilsTest(String JavaDoc name) {
48         super(name);
49     }
50
51     /**
52      * <p>
53      * This method maeks it easier to call these
54      * tests dynamically.
55      * </p>
56      *
57      * @return <code>TestSuite</code> - corresponds to this
58      * <code>TestCase</code>.
59      */

60     public static Test suite(){
61         return new TestSuite(DTDUtilsTest.class);
62     }
63
64     /**
65      * <p>
66      * This tests the <code>{@link DTDUtils#isSimpleType}</code> method.
67      * </p>
68      */

69     public void testIsSimpleType() {
70         DTDElement element = new DTDElement();
71         boolean ignoreIDAttributes = true;
72         element.setContent(new DTDPCData());
73         assertTrue(DTDUtils.isSimpleElement(element, ignoreIDAttributes));
74         
75         DTDName name = new DTDName("child");
76         element.setContent(name);
77         assertTrue(!DTDUtils.isSimpleElement(element, ignoreIDAttributes));
78     }
79 }
80
Popular Tags