Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: fix JSON sample test (#1417)
  • Loading branch information
zoercai committed Sep 9, 2021
1 parent fb154cd commit dc1f9a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -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"
Expand All @@ -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"));
}
}
}
Expand Down
Expand Up @@ -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
Expand Down Expand Up @@ -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.