1 7 8 package org.dom4j.datatype; 9 10 import junit.textui.TestRunner; 11 12 import java.math.BigDecimal ; 13 import java.math.BigInteger ; 14 import java.util.Calendar ; 15 16 import org.dom4j.DocumentFactory; 17 import org.dom4j.io.SAXReader; 18 19 26 public class DataTypesTest extends AbstractDataTypeTestCase { 27 public static void main(String [] args) { 28 TestRunner.run(DataTypesTest.class); 29 } 30 31 public void testgMonthDay() throws Exception { 34 testNodes("//gMonthDayTag", Calendar .class); 35 } 36 37 public void testgDay() throws Exception { 38 testNodes("//gDayTag", Calendar .class); 39 } 40 41 public void testgMonth() throws Exception { 42 testNodes("//gMonthTag", Calendar .class); 43 } 44 45 public void testDate() throws Exception { 46 testNodes("//dateTag", Calendar .class); 47 } 48 49 public void testTime() throws Exception { 50 testNodes("//timeTag", Calendar .class); 51 } 52 53 public void testDateTime() throws Exception { 54 testNodes("//dateTimeTag", Calendar .class); 55 } 56 57 public void testgYearMonth() throws Exception { 58 testNodes("//gYearMonthTag", Calendar .class); 59 } 60 61 public void testgYear() throws Exception { 62 testNodes("//gYearTag", Calendar .class); 63 } 64 65 public void testBoolean() throws Exception { 66 testNodes("//booleanTag", Boolean .class); 67 } 68 69 public void testBase64Binary() throws Exception { 70 testNodes("//base64BinaryTag", byte[].class); 71 } 72 73 public void testHexBinary() throws Exception { 74 testNodes("//hexBinaryTag", byte[].class); 75 } 76 77 public void testFloat() throws Exception { 79 testNodes("//floatTag", Float .class); 80 } 81 82 public void testDouble() throws Exception { 83 testNodes("//doubleTag", Double .class); 84 } 85 86 public void testDecimal() throws Exception { 87 testNodes("//decimalTag", BigDecimal .class); 88 } 89 90 public void testInteger() throws Exception { 91 testNodes("//integerTag", BigInteger .class); 92 } 93 94 public void testNonPositiveInteger() throws Exception { 95 testNodes("//nonPositiveIntegerTag", BigInteger .class); 96 } 97 98 public void testNegativeInteger() throws Exception { 99 testNodes("//negativeIntegerTag", BigInteger .class); 100 } 101 102 public void testLong() throws Exception { 103 testNodes("//longTag", Long .class); 104 } 105 106 public void testInt() throws Exception { 107 testNodes("//intTag", Integer .class); 108 } 109 110 public void testShort() throws Exception { 111 testNodes("//shortTag", Short .class); 112 } 113 114 public void testByte() throws Exception { 115 testNodes("//byteTag", Byte .class); 116 } 117 118 public void testNonNegativeInteger() throws Exception { 119 testNodes("//nonNegativeIntegerTag", BigInteger .class); 120 } 121 122 public void testUnsignedLong() throws Exception { 123 testNodes("//unsignedLongTag", BigInteger .class); 124 } 125 126 public void testUnsignedInt() throws Exception { 127 testNodes("//unsignedIntTag", Long .class); 128 } 129 130 public void testUnsignedShort() throws Exception { 131 testNodes("//unsignedShortTag", Integer .class); 132 } 133 134 public void testUnsignedByte() throws Exception { 135 testNodes("//unsignedByteTag", Short .class); 136 } 137 138 public void testPositiveInteger() throws Exception { 139 testNodes("//positiveIntegerTag", BigInteger .class); 140 } 141 142 protected void setUp() throws Exception { 145 super.setUp(); 146 147 DocumentFactory factory = DatatypeDocumentFactory.getInstance(); 148 SAXReader reader = new SAXReader(factory); 149 document = getDocument("/xml/test/schema/test.xml", reader); 150 } 151 } 152 153 189 | Popular Tags |