mirror of
https://github.com/ultrasonic/ultrasonic
synced 2024-12-26 16:53:26 +01:00
Fix methods in integration tests
This commit is contained in:
parent
f6f9683a9c
commit
f0447105d2
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user