1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.dbunit.ext.mysql;
22
23 import org.dbunit.dataset.datatype.AbstractDataTypeFactoryTest;
24 import org.dbunit.dataset.datatype.DataType;
25 import org.dbunit.dataset.datatype.IDataTypeFactory;
26
27 import java.sql.Types;
28
29
30
31
32
33
34 public class MySqlDataTypeFactoryTest extends AbstractDataTypeFactoryTest
35 {
36 public MySqlDataTypeFactoryTest(String s)
37 {
38 super(s);
39 }
40
41 public IDataTypeFactory createFactory() throws Exception
42 {
43 return new MySqlDataTypeFactory();
44 }
45
46 public void testCreateLongtextDataType() throws Exception
47 {
48 DataType actual = createFactory().createDataType(Types.OTHER, "longtext");
49 DataType expected = DataType.CLOB;
50 assertSame("type", expected, actual);
51 }
52
53 public void testCreateLongtextUpperCaseDataType() throws Exception
54 {
55
56 DataType actual = createFactory().createDataType(Types.OTHER, "LONGTEXT");
57 DataType expected = DataType.CLOB;
58 assertSame("type", expected, actual);
59 }
60
61 public void testCreateBooleanDataType() throws Exception
62 {
63 DataType actual = createFactory().createDataType(Types.OTHER, "bit");
64 DataType expected = DataType.BOOLEAN;
65 assertSame("type", expected, actual);
66 }
67
68 public void testCreateBooleanUpperCaseDataType() throws Exception
69 {
70
71 DataType actual = createFactory().createDataType(Types.OTHER, "BIT");
72 DataType expected = DataType.BOOLEAN;
73 assertSame("type", expected, actual);
74 }
75
76 public void testCreatePointDataType() throws Exception
77 {
78 DataType actual = createFactory().createDataType(Types.OTHER, "point");
79 DataType expected = DataType.BINARY;
80 assertSame("type", expected, actual);
81 }
82
83 public void testCreatePointUpperCaseDataType() throws Exception
84 {
85
86 DataType actual = createFactory().createDataType(Types.OTHER, "POINT");
87 DataType expected = DataType.BINARY;
88 assertSame("type", expected, actual);
89 }
90
91 public void testCreateTinyintUnsignedDatatype() throws Exception
92 {
93 int sqlType = Types.BIT;
94 String sqlTypeName = MySqlDataTypeFactory.SQL_TYPE_NAME_TINYINT_UNSIGNED;
95
96 DataType expected = DataType.TINYINT;
97 DataType actual = createFactory().createDataType(sqlType, sqlTypeName);
98 assertSame("type", expected, actual);
99 }
100
101 public void testCreateIntegerUnsignedDatatype() throws Exception
102 {
103 int sqlType = Types.INTEGER;
104 String sqlTypeName = "INTEGER" + MySqlDataTypeFactory.UNSIGNED_SUFFIX;
105
106 DataType expected = DataType.BIGINT;
107 DataType actual = createFactory().createDataType(sqlType, sqlTypeName);
108 assertSame("type", expected, actual);
109 }
110
111 }