diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java index 815fb5f2dc2c..2966ef80cff5 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java @@ -730,7 +730,8 @@ public void serialization() { reserializeAndAssert(Value.float64Array(BrokenSerializationList.of(.1, .2, .3))); reserializeAndAssert(Value.float64Array((Iterable) null)); - reserializeAndAssert(Value.stringArray(BrokenSerializationList.of("a", "b"))); + BrokenSerializationList of = BrokenSerializationList.of("a", "b"); + reserializeAndAssert(Value.stringArray(of)); reserializeAndAssert(Value.stringArray(null)); reserializeAndAssert( @@ -738,6 +739,11 @@ public void serialization() { reserializeAndAssert(Value.bytesArray(null)); } + @Test(expected = IllegalStateException.class) + public void verifyBrokenSerialization() { + reserializeAndAssert(BrokenSerializationList.of(1, 2, 3)); + } + private static class BrokenSerializationList extends ForwardingList implements Serializable { private final List delegate;