1
0
mirror of https://github.com/ultrasonic/ultrasonic synced 2024-12-27 09:13:31 +01:00

Fix methods in integration tests

This commit is contained in:
tzugen 2022-03-19 18:29:53 +01:00
parent f6f9683a9c
commit f0447105d2
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930

View File

@ -8,7 +8,7 @@ import java.util.Locale
import java.util.TimeZone import java.util.TimeZone
import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer import okhttp3.mockwebserver.MockWebServer
import okio.Okio import okio.buffer
import okio.source import okio.source
import org.amshove.kluent.`should be` import org.amshove.kluent.`should be`
import org.amshove.kluent.`should contain` import org.amshove.kluent.`should contain`
@ -41,12 +41,12 @@ fun MockWebServer.enqueueResponse(resourceName: String) {
} }
fun Any.loadJsonResponse(name: String): String { fun Any.loadJsonResponse(name: String): String {
val source = Okio.buffer(javaClass.classLoader.getResourceAsStream(name).source()) val source = javaClass.classLoader.getResourceAsStream(name)!!.source().buffer()
return source.readString(Charset.forName("UTF-8")) return source.readString(Charset.forName("UTF-8"))
} }
fun Any.loadResourceStream(name: String): InputStream { fun Any.loadResourceStream(name: String): InputStream {
val source = Okio.buffer(javaClass.classLoader.getResourceAsStream(name).source()) val source = javaClass.classLoader.getResourceAsStream(name)!!.source().buffer()
return source.inputStream() return source.inputStream()
} }