Skip to content

Commit f703f0f

Browse files
committed
Revert "fix: Use classloader for loading test resources to ensure CI compatibility"
This reverts commit ec23701.
1 parent ec23701 commit f703f0f

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

auth0/src/test/java/com/auth0/android/util/AuthenticationAPIMockServer.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.auth0.android.util
22

33
import okhttp3.mockwebserver.MockResponse
4+
import java.nio.file.Files
5+
import java.nio.file.Paths
46

57
internal class AuthenticationAPIMockServer : APIMockServer() {
68

@@ -126,14 +128,11 @@ internal class AuthenticationAPIMockServer : APIMockServer() {
126128

127129
fun willReturnValidJsonWebKeys(): AuthenticationAPIMockServer {
128130
try {
129-
// Use classloader to load resource file - works regardless of working directory
130-
val inputStream = this::class.java.classLoader?.getResourceAsStream("rsa_jwks.json")
131-
?: throw IllegalStateException("Could not find rsa_jwks.json in test resources")
132-
val json = inputStream.bufferedReader().use { it.readText() }
131+
val encoded = Files.readAllBytes(Paths.get("src/test/resources/rsa_jwks.json"))
132+
val json = String(encoded)
133133
server.enqueue(responseWithJSON(json, 200))
134-
} catch (e: Exception) {
135-
println("File parsing error: ${e.message}")
136-
throw e
134+
} catch (ignored: Exception) {
135+
println("File parsing error")
137136
}
138137
return this
139138
}

0 commit comments

Comments
 (0)