Skip to content

Commit

Permalink
chore: NPE in testConnectionClose (#2072)
Browse files Browse the repository at this point in the history
* Added a not null assertion for connection in testConnectionClose

* Added testCreateDefaultConnection
  • Loading branch information
prash-mi committed May 26, 2022
1 parent 4e153f5 commit 51694d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Expand Up @@ -2724,6 +2724,15 @@ public void testReadAPIIterationAndOrder()
connection.close();
}

// Ref: https://github.com/googleapis/java-bigquery/issues/2070. Adding a pre-submit test to see
// if bigquery.createConnection() returns null
@Test
public void testCreateDefaultConnection() throws BigQuerySQLException {
Connection connection = bigquery.createConnection();
assertNotNull("bigquery.createConnection() returned null", connection);
assertTrue(connection.close());
}

@Test
public void testReadAPIConnectionMultiClose()
throws
Expand Down
Expand Up @@ -341,6 +341,7 @@ public void testIterateAndOrderDefaultConnSettings() throws SQLException {
@Test
public void testConnectionClose() throws SQLException {
Connection connection = bigquery.createConnection();
assertNotNull("bigquery.createConnection() returned null", connection);
BigQueryResult bigQueryResult = connection.executeSelect(QUERY);
logger.log(Level.INFO, "Query used: {0}", QUERY);
ResultSet rs = bigQueryResult.getResultSet();
Expand Down

0 comments on commit 51694d8

Please sign in to comment.