Skip to content

Commit 8210ee3

Browse files
author
Mairbek Khadikov
committed
Statement reserialization test
1 parent 893d9f1 commit 8210ee3

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

google-cloud-spanner/src/test/java/com/google/cloud/spanner/StatementTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static com.google.common.testing.SerializableTester.reserializeAndAssert;
2020
import static com.google.common.truth.Truth.assertThat;
2121

22+
import com.google.cloud.ByteArray;
2223
import com.google.common.collect.ImmutableMap;
2324
import com.google.common.testing.EqualsTester;
2425
import org.junit.Rule;
@@ -42,6 +43,19 @@ public void basic() {
4243
reserializeAndAssert(stmt);
4344
}
4445

46+
@Test
47+
public void serialization() throws Exception {
48+
Statement stmt = Statement.newBuilder("SELECT * FROM table WHERE ")
49+
.append("bool_field = @bool_field ").bind("bool_field").to(true)
50+
.append("long_field = @long_field ").bind("long_field").to(1L)
51+
.append("float_field = @float_field ").bind("float_field").to(1.)
52+
.append("string_field = @string_field ").bind("string_field").to("abc")
53+
.append("bytes_field = @bytes_field ").bind("bytes_field")
54+
.to(ByteArray.fromBase64("abcd"))
55+
.build();
56+
reserializeAndAssert(stmt);
57+
}
58+
4559
@Test
4660
public void append() {
4761
Statement stmt =

0 commit comments

Comments
 (0)