@@ -27,12 +27,12 @@ public abstract class BinaryDataTypeEncodeTestBase extends DataTypeTestBase {
27
27
public void testSmallInt (TestContext ctx ) {
28
28
testEncodeGeneric (ctx , "test_int_2" , Short .class , (short ) Short .MIN_VALUE );
29
29
}
30
-
30
+
31
31
@ Test
32
32
public void testInteger (TestContext ctx ) {
33
33
testEncodeGeneric (ctx , "test_int_4" , Integer .class , (int ) Integer .MIN_VALUE );
34
34
}
35
-
35
+
36
36
@ Test
37
37
public void testBigInt (TestContext ctx ) {
38
38
testEncodeGeneric (ctx , "test_int_8" , Long .class , (long ) Long .MIN_VALUE );
@@ -82,7 +82,55 @@ public void testDate(TestContext ctx) {
82
82
public void testTime (TestContext ctx ) {
83
83
testEncodeGeneric (ctx , "test_time" , LocalTime .class , LocalTime .of (12 ,1 ,30 ));
84
84
}
85
-
85
+
86
+ @ Test
87
+ public void testNullValues (TestContext ctx ) {
88
+ connector .connect (ctx .asyncAssertSuccess (conn -> {
89
+ conn
90
+ .preparedQuery (statement ("UPDATE basicdatatype SET" +
91
+ " test_int_2 = " ,
92
+ ", test_int_4 = " ,
93
+ ", test_int_8 = " ,
94
+ ", test_float_4 = " ,
95
+ ", test_float_8 = " ,
96
+ ", test_numeric = " ,
97
+ ", test_decimal = " ,
98
+ ", test_boolean = " ,
99
+ ", test_char = " ,
100
+ ", test_varchar = " ,
101
+ ", test_date = " ,
102
+ ", test_time = " ,
103
+ " WHERE id = 2" ))
104
+ .execute (Tuple .tuple ()
105
+ .addValue (null )
106
+ .addValue (null )
107
+ .addValue (null )
108
+ .addValue (null )
109
+ .addValue (null )
110
+ .addValue (null )
111
+ .addValue (null )
112
+ .addValue (null )
113
+ .addValue (null )
114
+ .addValue (null )
115
+ .addValue (null )
116
+ .addValue (null ),
117
+ ctx .asyncAssertSuccess (updateResult -> {
118
+ conn
119
+ .preparedQuery ("SELECT * FROM basicdatatype WHERE id = 2" )
120
+ .execute (ctx .asyncAssertSuccess (result -> {
121
+ ctx .assertEquals (1 , result .size ());
122
+ Row row = result .iterator ().next ();
123
+ ctx .assertEquals (13 , row .size ());
124
+ ctx .assertEquals (2 , row .getInteger (0 ));
125
+ for (int i = 1 ; i < 13 ; i ++) {
126
+ ctx .assertNull (row .getValue (i ));
127
+ }
128
+ conn .close ();
129
+ }));
130
+ }));
131
+ }));
132
+ }
133
+
86
134
protected <T > void testEncodeGeneric (TestContext ctx ,
87
135
String columnName ,
88
136
Class <T > clazz ,
@@ -96,6 +144,7 @@ protected <T> void testEncodeGeneric(TestContext ctx,
96
144
.execute (ctx .asyncAssertSuccess (result -> {
97
145
ctx .assertEquals (1 , result .size ());
98
146
Row row = result .iterator ().next ();
147
+ ctx .assertEquals (1 , row .size ());
99
148
ctx .assertEquals (expected , row .getValue (0 ));
100
149
ctx .assertEquals (expected , row .getValue (columnName ));
101
150
// ctx.assertEquals(expected, row.get(clazz, 0));
0 commit comments