Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix JSON sample test #1417

Merged
merged 3 commits into from Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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}");
}
}