1 7 8 package org.dom4j.dtd; 9 10 import junit.textui.TestRunner; 11 12 import org.dom4j.AbstractTestCase; 13 14 29 public class InternalEntityDeclTest extends AbstractTestCase { 30 public static void main(String [] args) { 31 TestRunner.run(InternalEntityDeclTest.class); 32 } 33 34 public void testToString() { 37 InternalEntityDecl decl1 = new InternalEntityDecl("name", "value"); 38 InternalEntityDecl decl2 = new InternalEntityDecl("%name", "value"); 39 40 assertEquals("<!ENTITY name \"value\">", decl1.toString()); 41 assertEquals("<!ENTITY % name \"value\">", decl2.toString()); 42 } 43 44 77 public void testParameterEntity() { 78 String expectedName = "%boolean"; 79 80 String expectedValue = "( true | false )"; 81 82 String expectedText = "<!ENTITY % boolean \"( true | false )\">"; 83 84 InternalEntityDecl actual = new InternalEntityDecl(expectedName, 85 expectedValue); 86 87 assertEquals("name is correct", expectedName, actual.getName()); 88 89 assertEquals("value is correct", expectedValue, actual.getValue()); 90 91 assertEquals("toString() is correct", expectedText, actual.toString()); 92 } 93 94 105 public void testGeneralEntity() { 106 String expectedName = "foo"; 107 108 String expectedValue = "bar"; 109 110 String expectedText = "<!ENTITY foo \"bar\">"; 111 112 InternalEntityDecl actual = new InternalEntityDecl(expectedName, 113 expectedValue); 114 115 assertEquals("name is correct", expectedName, actual.getName()); 116 117 assertEquals("value is correct", expectedValue, actual.getValue()); 118 119 assertEquals("toString() is correct", expectedText, actual.toString()); 120 } 121 } 122 123 159 | Popular Tags |