Skip to content

Commit

Permalink
code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-akolodziejczyk committed Dec 5, 2024
1 parent efa6919 commit fc75179
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ class ExternalBrowserIT {

String login = AuthConnectionParameters.SSO_USER;
String password = AuthConnectionParameters.SSO_PASSWORD;
AuthTest authTest;
AuthTest authTest = new AuthTest();

@BeforeEach
public void setUp() throws IOException {
authTest = new AuthTest();
AuthTest.deleteIdToken();
}

Expand Down
14 changes: 4 additions & 10 deletions src/test/java/net/snowflake/client/authentication/IdTokenIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

import java.io.IOException;
import net.snowflake.client.category.TestTags;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Tag;
Expand All @@ -22,19 +21,14 @@ class IdTokenIT {

String login = AuthConnectionParameters.SSO_USER;
String password = AuthConnectionParameters.SSO_PASSWORD;
AuthTest authTest;
AuthTest authTest = new AuthTest();
private static String firstToken;

@BeforeAll
public static void globalSetUp() {
AuthTest.deleteIdToken();
}

@BeforeEach
public void setUp() throws IOException {
authTest = new AuthTest();
}

@AfterEach
public void tearDown() {
authTest.cleanBrowserProcesses();
Expand All @@ -51,7 +45,7 @@ void shouldAuthenticateUsingExternalBrowserAndSaveToken() throws InterruptedExce
authTest.connectAndProvideCredentials(provideCredentialsThread, connectThread);
authTest.verifyExceptionIsNotThrown();
firstToken = authTest.getIdToken();
verifyFirstTokenWasSaved();
assertThat("Id token was not saved", firstToken, notNullValue());
}

@Test
Expand Down Expand Up @@ -80,6 +74,6 @@ void shouldOpenBrowserAgainWhenTokenIsDeleted() throws InterruptedException {
}

private void verifyFirstTokenWasSaved() {
assertThat("Id token was not saved", firstToken, notNullValue());
assumeTrue(firstToken != null, "token was not saved, skipping test");
}
}

0 comments on commit fc75179

Please sign in to comment.