KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dom4j > dtd > ElementDeclTest


1 /*
2  * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
3  *
4  * This software is open source.
5  * See the bottom of this file for the licence.
6  */

7
8 package org.dom4j.dtd;
9
10 import junit.textui.TestRunner;
11
12 import org.dom4j.AbstractTestCase;
13
14 /**
15  * Tests the {@link ElementDecl}functionality. Tests each of the property
16  * access methods and the serialization mechanisms. Correct parsing is tested by
17  * {@link DocTypeTest}.
18  *
19  * <P>
20  * </p>
21  *
22  * @author Bryan Thompson
23  * @author Maarten Coene
24  * @version $Revision: 1.3 $
25  *
26  * @todo The dom4j documentation needs to describe what representation SHOULD be
27  * generated by {@link ElementDecl#toString()}.
28  */

29 public class ElementDeclTest extends AbstractTestCase {
30     public static void main(String JavaDoc[] args) {
31         TestRunner.run(ElementDeclTest.class);
32     }
33
34     // Test case(s)
35
// -------------------------------------------------------------------------
36

37     /**
38      * Test
39      *
40      * <pre>
41      *
42      * &lt;!ELEMENT an-element (#PCDATA)&gt;
43      *
44      * </pre>
45      */

46     public void testSimpleElementDecl() {
47         String JavaDoc expectedName = "an-element";
48
49         String JavaDoc expectedModel = "(#PCDATA)";
50
51         String JavaDoc expectedText = "<!ELEMENT an-element (#PCDATA)>";
52
53         ElementDecl actual = new ElementDecl(expectedName, expectedModel);
54
55         assertEquals("name is correct", expectedName, actual.getName());
56
57         assertEquals("model is correct", expectedModel, actual.getModel());
58
59         assertEquals("toString() is correct", expectedText, actual.toString());
60     }
61
62     // Implementation methods
63
// -------------------------------------------------------------------------
64
}
65
66 /*
67  * Redistribution and use of this software and associated documentation
68  * ("Software"), with or without modification, are permitted provided that the
69  * following conditions are met:
70  *
71  * 1. Redistributions of source code must retain copyright statements and
72  * notices. Redistributions must also contain a copy of this document.
73  *
74  * 2. Redistributions in binary form must reproduce the above copyright notice,
75  * this list of conditions and the following disclaimer in the documentation
76  * and/or other materials provided with the distribution.
77  *
78  * 3. The name "DOM4J" must not be used to endorse or promote products derived
79  * from this Software without prior written permission of MetaStuff, Ltd. For
80  * written permission, please contact dom4j-info@metastuff.com.
81  *
82  * 4. Products derived from this Software may not be called "DOM4J" nor may
83  * "DOM4J" appear in their names without prior written permission of MetaStuff,
84  * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
85  *
86  * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
87  *
88  * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND
89  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
90  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
91  * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE
92  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
93  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
94  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
95  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
96  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
97  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
98  * POSSIBILITY OF SUCH DAMAGE.
99  *
100  * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
101  */

102
Popular Tags