Skip to content

Commit

Permalink
Updated testDSPooledConnectionAccessTokenCallbackClassExceptions test…
Browse files Browse the repository at this point in the history
… case in PooledConnectionTest.java
  • Loading branch information
Ananya2 authored Nov 27, 2024
1 parent 5a83a57 commit 1358f94
Showing 1 changed file with 1 addition and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -435,29 +435,8 @@ public void testDSPooledConnectionAccessTokenCallbackClassExceptions() throws Ex

// User/password is not required for access token callback
AbstractTest.updateDataSource(accessTokenCallbackConnectionString, ds);
ds.setAccessTokenCallbackClass(AccessTokenCallbackClass.class.getName());
ds.setUser("user");
SQLServerPooledConnection pc;

// Should fail with user set
try {
pc = (SQLServerPooledConnection) ds.getPooledConnection();
fail(TestResource.getResource("R_expectedFailPassed"));
} catch (SQLServerException e) {
assertTrue(e.getMessage().matches(TestUtils.formatErrorMsg("R_AccessTokenCallbackWithUserPassword")));
}

ds.setUser("");
ds.setPassword(UUID.randomUUID().toString());

// Should fail with password set
try {
pc = (SQLServerPooledConnection) ds.getPooledConnection();
fail(TestResource.getResource("R_expectedFailPassed"));
} catch (SQLServerException e) {
assertTrue(e.getMessage().matches(TestUtils.formatErrorMsg("R_AccessTokenCallbackWithUserPassword")));
}


// Should fail with invalid accessTokenCallbackClass value
ds.setAccessTokenCallbackClass("Invalid");
ds.setUser("");
Expand Down

0 comments on commit 1358f94

Please sign in to comment.