Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
lateinit var server: MockWebServer
@Before
fun setUp() {
server = MockWebServer()
server.start()
}
@Test
fun test() {
server.enqueue(MockResponse().setBody(getJson("json/token.json")))
server.enqueue(MockResponse().setBody(getJson("json/eventos.json")))
}
fun getJson(path : String) : String {
// Load the JSON response
val uri = this.javaClass.classLoader.getResource(path)
val file = File(uri.path)
return String(file.readBytes())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment