File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed
google-cloud-spanner/src/test/java/com/google/cloud/spanner/it Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change 22
22
23
23
import com .google .cloud .spanner .Database ;
24
24
import com .google .cloud .spanner .DatabaseClient ;
25
+ import com .google .cloud .spanner .ErrorCode ;
25
26
import com .google .cloud .spanner .IntegrationTestEnv ;
26
27
import com .google .cloud .spanner .Mutation ;
27
28
import com .google .cloud .spanner .ParallelIntegrationTest ;
@@ -125,17 +126,21 @@ public void testWriteAndReadInvalidJsonValues() throws IOException {
125
126
Resources .toString (
126
127
Resources .getResource (this .getClass (), INVALID_JSON_DIR + File .separator + resource ),
127
128
StandardCharsets .UTF_8 );
128
- assertThrows (
129
- SpannerException .class ,
130
- () ->
131
- databaseClient .write (
132
- Collections .singletonList (
133
- Mutation .newInsertBuilder (TABLE_NAME )
134
- .set ("Id" )
135
- .to (id .getAndIncrement ())
136
- .set ("json" )
137
- .to (Value .json (jsonStr ))
138
- .build ())));
129
+
130
+ SpannerException exception =
131
+ assertThrows (
132
+ SpannerException .class ,
133
+ () ->
134
+ databaseClient .write (
135
+ Collections .singletonList (
136
+ Mutation .newInsertBuilder (TABLE_NAME )
137
+ .set ("Id" )
138
+ .to (id .getAndIncrement ())
139
+ .set ("json" )
140
+ .to (Value .json (jsonStr ))
141
+ .build ())));
142
+
143
+ assertEquals (ErrorCode .FAILED_PRECONDITION , exception .getErrorCode ());
139
144
}
140
145
}
141
146
You can’t perform that action at this time.
0 commit comments