1 /* 2 * Copyright 2001-2004 (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 * $Id: TestElementDecl.java,v 1.3 2004/06/25 08:03:49 maartenc Exp $ 8 */ 9 10 package org.dom4j.dtd; 11 12 import junit.framework.*; 13 import junit.textui.TestRunner; 14 15 /*** Tests the {@link ElementDecl} functionality. Tests each of the 16 * property access methods and the serialization mechanisms. Correct 17 * parsing is tested by {@link TestDocType}.<P> 18 * 19 * @todo The dom4j documentation needs to describe what 20 * representation SHOULD be generated by {@link 21 * ElementDecl#toString()}. 22 * 23 * @author Bryan Thompson 24 * @author Maarten Coene 25 * @version $Revision: 1.3 $ 26 */ 27 28 public class TestElementDecl extends TestCase { 29 30 31 public static void main( String[] args ) { 32 TestRunner.run( suite() ); 33 } 34 35 public static Test suite() { 36 return new TestSuite( TestElementDecl.class ); 37 } 38 39 public TestElementDecl(String name) { 40 super(name); 41 } 42 43 // Test case(s) 44 //------------------------------------------------------------------------- 45 46 /*** 47 * Test <pre><!ELEMENT an-element (#PCDATA)></pre> 48 */ 49 50 public void testSimpleElementDecl() 51 { 52 53 String expectedName = "an-element"; 54 55 String expectedModel = "(#PCDATA)"; 56 57 String expectedText = "<!ELEMENT an-element (#PCDATA)>"; 58 59 ElementDecl actual = new ElementDecl 60 ( expectedName, 61 expectedModel 62 ); 63 64 assertEquals 65 ( "name is correct", 66 expectedName, 67 actual.getName() 68 ); 69 70 assertEquals 71 ( "model is correct", 72 expectedModel, 73 actual.getModel() 74 ); 75 76 assertEquals 77 ( "toString() is correct", 78 expectedText, 79 actual.toString() 80 ); 81 82 } 83 84 // Implementation methods 85 //------------------------------------------------------------------------- 86 87 88 } 89 90 91 92 /* 93 * Redistribution and use of this software and associated documentation 94 * ("Software"), with or without modification, are permitted provided 95 * that the following conditions are met: 96 * 97 * 1. Redistributions of source code must retain copyright 98 * statements and notices. Redistributions must also contain a 99 * copy of this document. 100 * 101 * 2. Redistributions in binary form must reproduce the 102 * above copyright notice, this list of conditions and the 103 * following disclaimer in the documentation and/or other 104 * materials provided with the distribution. 105 * 106 * 3. The name "DOM4J" must not be used to endorse or promote 107 * products derived from this Software without prior written 108 * permission of MetaStuff, Ltd. For written permission, 109 * please contact dom4j-info@metastuff.com. 110 * 111 * 4. Products derived from this Software may not be called "DOM4J" 112 * nor may "DOM4J" appear in their names without prior written 113 * permission of MetaStuff, Ltd. DOM4J is a registered 114 * trademark of MetaStuff, Ltd. 115 * 116 * 5. Due credit should be given to the DOM4J Project - 117 * http://www.dom4j.org 118 * 119 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS 120 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT 121 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 122 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 123 * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 124 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 125 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 126 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 127 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 128 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 129 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 130 * OF THE POSSIBILITY OF SUCH DAMAGE. 131 * 132 * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved. 133 * 134 * $Id: TestElementDecl.java,v 1.3 2004/06/25 08:03:49 maartenc Exp $ 135 */