Skip to content

Commit

Permalink
Don't pass logger to toURI (Azure#35279)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmolkova authored Jun 2, 2023
1 parent 4660a38 commit fd53a93
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
* Base class for running live and playback tests using {@link InterceptorManager}.
*/
public abstract class TestBase implements BeforeEachCallback {
private static final ClientLogger LOGGER = new ClientLogger(TestBase.class);
// Environment variable name used to determine the TestMode.
private static final String AZURE_TEST_HTTP_CLIENTS = "AZURE_TEST_HTTP_CLIENTS";

Expand Down Expand Up @@ -153,7 +152,7 @@ public void setupTest(TestInfo testInfo) {
} else if (testInfo.getTags().contains("Live")) {
localTestMode = TestMode.LIVE;
}
Path testClassPath = Paths.get(toURI(testInfo.getTestClass().get().getResource(testInfo.getTestClass().get().getSimpleName() + ".class"), LOGGER));
Path testClassPath = Paths.get(toURI(testInfo.getTestClass().get().getResource(testInfo.getTestClass().get().getSimpleName() + ".class")));
this.testContextManager =
new TestContextManager(testInfo.getTestMethod().get(),
localTestMode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public TestProxyTestBase() {
@BeforeAll
public static void setupTestProxy(TestInfo testInfo) {
testMode = initializeTestMode();
Path testClassPath = Paths.get(toURI(testInfo.getTestClass().get().getResource(testInfo.getTestClass().get().getSimpleName() + ".class"), LOGGER));
Path testClassPath = Paths.get(toURI(testInfo.getTestClass().get().getResource(testInfo.getTestClass().get().getSimpleName() + ".class")));
if (isTestProxyEnabled() && (testMode == TestMode.PLAYBACK || testMode == TestMode.RECORD)) {
testProxyManager = new TestProxyManager(testClassPath);
testProxyManager.startProxy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static File getRecordFolder() {
if (folderUrl != null) {
// Use toURI as getResource will return a URL encoded file path that can only be cleaned up using the
// URI-based constructor of File.
return new File(toURI(folderUrl, LOGGER));
return new File(toURI(folderUrl));
}

throw new IllegalStateException("Unable to locate session-records folder. Please create a session-records "
Expand All @@ -135,14 +135,13 @@ public static File getRecordFolder() {
/**
* Returns a {@link java.net.URI} equivalent to this URL.
* @param url the url to be converted to URI
* @param logger the respective logger
* @return the URI
*/
public static URI toURI(URL url, ClientLogger logger) {
public static URI toURI(URL url) {
try {
return url.toURI();
} catch (URISyntaxException ex) {
throw logger.logExceptionAsError(new IllegalStateException(ex));
throw LOGGER.logExceptionAsError(new IllegalStateException(ex));
}
}

Expand Down

0 comments on commit fd53a93

Please sign in to comment.