Skip to content

Commit

Permalink
Modified bvtTests to be able to test resultSet closing explicitly.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheenamalhotra committed Oct 10, 2017
1 parent de471e7 commit eb7efe3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/test/java/com/microsoft/sqlserver/jdbc/bvt/bvtTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,11 @@ public void testTwoResultsetsDifferentStmt() throws SQLException {

try (DBConnection conn = new DBConnection(connectionString);
DBStatement stmt1 = conn.createStatement();
DBStatement stmt2 = conn.createStatement();
DBResultSet rs1 = stmt1.executeQuery(query);
DBResultSet rs2 = stmt2.executeQuery(query2)) {
DBStatement stmt2 = conn.createStatement()) {

DBResultSet rs1 = stmt1.executeQuery(query);
DBResultSet rs2 = stmt2.executeQuery(query2);

// Interleave resultset calls
rs1.next();
rs1.verifyCurrentRow(table1);
Expand All @@ -373,8 +374,10 @@ public void testTwoResultsetsDifferentStmt() throws SQLException {
rs1.next();
rs1.verifyCurrentRow(table1);
rs1.verify(table1);
rs1.close();
rs2.next();
rs2.verify(table2);
rs2.close();
}
}

Expand All @@ -390,10 +393,10 @@ public void testTwoResultsetsSameStmt() throws SQLException {
String query2 = "SELECT * FROM " + table2.getEscapedTableName();

try (DBConnection conn = new DBConnection(connectionString);
DBStatement stmt = conn.createStatement();
DBResultSet rs1 = stmt.executeQuery(query);
DBResultSet rs2 = stmt.executeQuery(query2)) {
DBStatement stmt = conn.createStatement()) {

DBResultSet rs1 = stmt.executeQuery(query);
DBResultSet rs2 = stmt.executeQuery(query2);
// Interleave resultset calls. rs is expected to be closed
try {
rs1.next();
Expand All @@ -409,8 +412,10 @@ public void testTwoResultsetsSameStmt() throws SQLException {
catch (SQLException e) {
assertEquals(e.toString(), "com.microsoft.sqlserver.jdbc.SQLServerException: The result set is closed.");
}
rs1.close();
rs2.next();
rs2.verify(table2);
rs2.close();
}
}

Expand Down

0 comments on commit eb7efe3

Please sign in to comment.