Basically instead of relying on the old `testMode`...
# kotlin-fuel
d
Basically instead of relying on the old
testMode
with blocking = true, which doesn't alllow us to test asynchronousliness, my refactor where only async requests are cancellable can now "wait" inline:
Copy code
@Test
    fun gsonTestResponseObjectAsync() {
        var isAsync = false
        val running = reflectedRequest(Method.GET, "user-agent")
            .responseObject(gsonDeserializerOf(HttpBinUserAgentModel::class.java)) { _, _, result ->
                val (data, error) = result
                assertThat("Expected data, actual error $error", data, notNullValue())
                assertThat("Expected data to have a user agent", data!!.userAgent, notNullValue())
                assertThat("Expected isAsync to be true, actual false", isAsync, equalTo(true))
            }

        isAsync = true
        running.join()

        assertThat(running.isDone, equalTo(true))
        assertThat(running.isCancelled, equalTo(false))
    }