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 2222
2323import com .google .cloud .spanner .Database ;
2424import com .google .cloud .spanner .DatabaseClient ;
25+ import com .google .cloud .spanner .ErrorCode ;
2526import com .google .cloud .spanner .IntegrationTestEnv ;
2627import com .google .cloud .spanner .Mutation ;
2728import com .google .cloud .spanner .ParallelIntegrationTest ;
@@ -125,17 +126,21 @@ public void testWriteAndReadInvalidJsonValues() throws IOException {
125126 Resources .toString (
126127 Resources .getResource (this .getClass (), INVALID_JSON_DIR + File .separator + resource ),
127128 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 ());
139144 }
140145 }
141146
You can’t perform that action at this time.
0 commit comments