File tree Expand file tree Collapse file tree
auth0/src/test/java/com/auth0/android/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com.auth0.android.util
22
33import okhttp3.mockwebserver.MockResponse
4+ import java.nio.file.Files
5+ import java.nio.file.Paths
46
57internal 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 }
You can’t perform that action at this time.
0 commit comments