1 9 10 package test.dom4j.datatype; 11 12 import junit.framework.Test; 13 import junit.framework.TestSuite; 14 import junit.textui.TestRunner; 15 import org.dom4j.Document; 16 import org.dom4j.DocumentFactory; 17 import org.dom4j.datatype.DatatypeDocumentFactory; 18 import org.dom4j.io.SAXReader; 19 20 import java.math.BigDecimal ; 21 import java.math.BigInteger ; 22 import java.util.Calendar ; 23 24 25 31 public class TestDataTypes extends AbstractDataTypeTest { 32 33 public static void main( String [] args ) { 34 TestRunner.run( suite() ); 35 } 36 37 public static Test suite() { 38 return new TestSuite( TestDataTypes.class ); 39 } 40 41 public TestDataTypes(String name) { 42 super(name); 43 } 44 45 48 62 63 public void testDate() throws Exception { 64 testNodes( "//dateTag", Calendar .class ); 65 } 66 67 public void testTime() throws Exception { 68 testNodes( "//timeTag", Calendar .class ); 69 } 70 public void testDateTime() throws Exception { 71 testNodes( "//dateTimeTag", Calendar .class ); 72 } 73 74 public void testgYearMonth() throws Exception { 75 testNodes( "//gYearMonthTag", Calendar .class ); 76 } 77 public void testgYear() throws Exception { 78 testNodes( "//gYearTag", Calendar .class ); 79 } 80 81 82 public void testBoolean() throws Exception { 83 testNodes( "//booleanTag", Boolean .class ); 84 } 85 86 public void testBase64Binary() throws Exception { 87 testNodes( "//base64BinaryTag", byte[].class ); 88 } 89 public void testHexBinary() throws Exception { 90 testNodes( "//hexBinaryTag", byte[].class ); 91 } 92 93 94 95 96 98 public void testFloat() throws Exception { 99 testNodes( "//floatTag", Float .class ); 100 } 101 public void testDouble() throws Exception { 102 testNodes( "//doubleTag", Double .class ); 103 } 104 105 106 public void testDecimal() throws Exception { 107 testNodes( "//decimalTag", BigDecimal .class ); 108 } 109 110 public void testInteger() throws Exception { 111 testNodes( "//integerTag", BigInteger .class ); 112 } 113 114 115 public void testNonPositiveInteger() throws Exception { 116 testNodes( "//nonPositiveIntegerTag", BigInteger .class ); 117 } 118 119 public void testNegativeInteger() throws Exception { 120 testNodes( "//negativeIntegerTag", BigInteger .class ); 121 } 122 123 public void testLong() throws Exception { 124 testNodes( "//longTag", Long .class ); 125 } 126 public void testInt() throws Exception { 127 testNodes( "//intTag", Integer .class ); 128 } 129 public void testShort() throws Exception { 130 testNodes( "//shortTag", Short .class ); 131 } 132 public void testByte() throws Exception { 133 testNodes( "//byteTag", Byte .class ); 134 } 135 136 public void testNonNegativeInteger() throws Exception { 137 testNodes( "//nonNegativeIntegerTag", BigInteger .class ); 138 } 139 140 public void testUnsignedLong() throws Exception { 141 testNodes( "//unsignedLongTag", BigInteger .class ); 142 } 143 144 public void testUnsignedInt() throws Exception { 145 testNodes( "//unsignedIntTag", Long .class ); 146 } 147 public void testUnsignedShort() throws Exception { 148 testNodes( "//unsignedShortTag", Integer .class ); 149 } 150 public void testUnsignedByte() throws Exception { 151 testNodes( "//unsignedByteTag", Short .class ); 152 } 153 154 public void testPositiveInteger() throws Exception { 155 testNodes( "//positiveIntegerTag", BigInteger .class ); 156 } 157 158 protected void setUp() throws Exception { 161 DocumentFactory factory = DatatypeDocumentFactory.getInstance(); 163 SAXReader reader = new SAXReader( factory ); 164 Document document = reader.read( "xml/test/schema/test.xml" ); 165 } 166 } 167 168 169 170 171 215 | Popular Tags |