Skip to content
Permalink
Browse files
fix: fix JSON sample test (#1417)
  • Loading branch information
zoercai committed Sep 9, 2021
1 parent fb154cd commit dc1f9a92a7562e2585e2762c2749eb3207f67c25
@@ -42,7 +42,7 @@ static void queryWithJsonParameter() {
}

static void queryWithJsonParameter(DatabaseClient client) {
String exampleJson = "{rating: 9}";
String exampleJson = "{\"rating\": 9}";
Statement statement =
Statement.newBuilder(
"SELECT VenueId, VenueDetails\n"
@@ -56,7 +56,7 @@ static void queryWithJsonParameter(DatabaseClient client) {
while (resultSet.next()) {
System.out.printf(
"VenueId: %s, VenueDetails: %s%n",
resultSet.getLong("VenueId"), resultSet.getString("VenueDetails"));
resultSet.getLong("VenueId"), resultSet.getJson("VenueDetails"));
}
}
}
@@ -238,7 +238,7 @@ public void updateJsonData_shouldWriteData() {
() ->
UpdateJsonDataSample.updateJsonData(
spanner.getDatabaseClient(DatabaseId.of(projectId, instanceId, databaseId))));
assertThat(out).contains("VenueDetails successfully updated");
assertThat(out).contains("Venues successfully updated");
}

@Test
@@ -274,6 +274,6 @@ public void queryWithJsonParameter_shouldReturnResults() {
+ "\"tags\":[\"large\",\"airy\"]}"))
.build()));
String out = runExample(() -> QueryWithJsonParameterSample.queryWithJsonParameter(client));
assertThat(out).contains("4 35000");
assertThat(out).contains("VenueId: 19, VenueDetails: {\"open\":true,\"rating\":9}");
}
}

0 comments on commit dc1f9a9

Please sign in to comment.