1 19 package org.enhydra.zeus.binding; 20 21 import java.util.BitSet ; 22 import java.util.Vector ; 23 24 import junit.framework.Test; 25 import junit.framework.TestCase; 26 import junit.framework.TestSuite; 27 28 36 public class AtomicPropertyTest extends AbstractPropertyTest { 37 38 39 private Vector enumeratedValues; 40 41 44 private BitSet modifiers; 45 46 47 private AtomicProperty atomicProperty; 48 49 57 protected Property createProperty() { 58 return new AtomicProperty("xmlName", "xmlType"); 59 } 60 61 68 public AtomicPropertyTest(String name) { 69 super(name); 70 } 71 72 81 public static Test suite() { 82 return new TestSuite(AtomicPropertyTest.class); 83 } 84 85 90 protected void setup() { 91 enumeratedValues = new Vector (); 92 enumeratedValues.add("value1"); 93 enumeratedValues.add("value2"); 94 95 modifiers = new BitSet (); 96 modifiers.set(Property.ACCESS_PRIVATE); 97 modifiers.set(Property.SOURCE_ATTLIST); 98 99 atomicProperty = new AtomicProperty("xmlName", "xmlType"); 100 } 101 102 107 protected void teardown() { 108 enumeratedValues = null; 109 modifiers = null; 110 atomicProperty = null; 111 } 112 113 118 public void testConstructor1() { 119 setup(); 120 atomicProperty = new AtomicProperty("xmlName", 121 "namespaceURI", 122 "xmlType", 123 "typeNamespaceURI", 124 modifiers, 125 enumeratedValues, 126 "defaultValue"); 127 assertTrue(atomicProperty != null); 128 assertTrue(atomicProperty.getXMLName().equals("xmlName")); 129 assertTrue(atomicProperty.getXMLNamespaceURI().equals("namespaceURI")); 130 assertTrue(atomicProperty.getXMLType().equals("xmlType")); 131 assertTrue( 132 atomicProperty.getXMLTypeNamespaceURI().equals("typeNamespaceURI")); 133 assertTrue(atomicProperty.getModifierString().equals("private")); 134 assertTrue(atomicProperty.getEnumeration() == enumeratedValues); 135 assertTrue(((String )atomicProperty.getDefaultValue()) 136 .equals("defaultValue")); 137 } 138 139 144 public void testConstructor2() { 145 setup(); 146 atomicProperty = new AtomicProperty("xmlName", 147 "namespaceURI", 148 "xmlType", 149 "typeNamespaceURI"); 150 assertTrue(atomicProperty != null); 151 assertTrue(atomicProperty.getXMLName().equals("xmlName")); 152 assertTrue(atomicProperty.getXMLNamespaceURI().equals("namespaceURI")); 153 assertTrue(atomicProperty.getXMLType().equals("xmlType")); 154 assertTrue( 155 atomicProperty.getXMLTypeNamespaceURI().equals("typeNamespaceURI")); 156 assertTrue(!atomicProperty.hasDefaultValue()); 157 assertTrue(atomicProperty.getEnumeration() == null); 158 } 159 160 165 public void testConstructor3() { 166 setup(); 167 atomicProperty = new AtomicProperty("xmlName", "xmlType"); 168 assertTrue(atomicProperty != null); 169 assertTrue(atomicProperty.getXMLName().equals("xmlName")); 170 assertTrue(atomicProperty.getXMLNamespaceURI().equals("")); 171 assertTrue(atomicProperty.getXMLType().equals("xmlType")); 172 assertTrue(atomicProperty.getXMLTypeNamespaceURI().equals("")); 173 assertTrue(!atomicProperty.hasDefaultValue()); 174 assertTrue(atomicProperty.getEnumeration() == null); 175 } 176 } 177 178 | Popular Tags |