diff --git a/src/test/java/net/snowflake/client/authentication/AuthTest.java b/src/test/java/net/snowflake/client/authentication/AuthTest.java index 3cc4c1f3a..dd528d64a 100644 --- a/src/test/java/net/snowflake/client/authentication/AuthTest.java +++ b/src/test/java/net/snowflake/client/authentication/AuthTest.java @@ -28,25 +28,11 @@ public AuthTest() { } public Thread getConnectAndExecuteSimpleQueryThread(Properties props, String sessionParameters) { - return new Thread( - () -> { - try { - connectAndExecuteSimpleQuery(props, sessionParameters); - } catch (Exception e) { - this.exception = e; - } - }); + return new Thread(() -> connectAndExecuteSimpleQuery(props, sessionParameters)); } public Thread getConnectAndExecuteSimpleQueryThread(Properties props) { - return new Thread( - () -> { - try { - connectAndExecuteSimpleQuery(props, null); - } catch (Exception e) { - this.exception = e; - } - }); + return new Thread(() -> connectAndExecuteSimpleQuery(props, null)); } public void verifyExceptionIsThrown(String message) { @@ -100,8 +86,7 @@ public static void deleteIdToken() { AuthConnectionParameters.HOST, AuthConnectionParameters.SSO_USER); } - public void connectAndExecuteSimpleQuery(Properties props, String sessionParameters) - throws SQLException { + public void connectAndExecuteSimpleQuery(Properties props, String sessionParameters) { String url = String.format("jdbc:snowflake://%s:%s", props.get("host"), props.get("port")); if (sessionParameters != null) { url += "?" + sessionParameters; @@ -112,6 +97,8 @@ public void connectAndExecuteSimpleQuery(Properties props, String sessionParamet assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); saveToken(con); + } catch (SQLException e) { + this.exception = e; } } diff --git a/src/test/java/net/snowflake/client/authentication/IdTokenIT.java b/src/test/java/net/snowflake/client/authentication/IdTokenIT.java index 9a16c863b..f784ab87a 100644 --- a/src/test/java/net/snowflake/client/authentication/IdTokenIT.java +++ b/src/test/java/net/snowflake/client/authentication/IdTokenIT.java @@ -6,7 +6,6 @@ import static org.hamcrest.Matchers.notNullValue; import java.io.IOException; -import java.sql.SQLException; import net.snowflake.client.category.TestTags; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; @@ -57,7 +56,7 @@ void shouldAuthenticateUsingExternalBrowserAndSaveToken() throws InterruptedExce @Test @Order(2) - void shouldAuthenticateUsingTokenWithoutBrowser() throws SQLException { + void shouldAuthenticateUsingTokenWithoutBrowser() { verifyFirstTokenWasSaved(); authTest.connectAndExecuteSimpleQuery(getStoreIDTokenConnectionParameters(), null); authTest.verifyExceptionIsNotThrown();