【发布时间】:2021-05-05 04:24:18
【问题描述】:
我正在编写一个单元测试,我想抛出一个错误代码为 409 的 HttpException。
这是我尝试过的,但它给了我一个错误
Using 'parse(String): MediaType?' is an error. moved to extension function
这是一个kotlin文件和Retrofit 2.6.0,ResponseBody是okhttp3 - 3.12.12
我尝试过的
every(call.execute()).thenThrow(HttpException(
Response.error<Any>(409, ResponseBody.create(
MediaType.parse("plain/text"), ""
))
))
请问我该如何解决
谢谢 回复
【问题讨论】:
标签: android kotlin retrofit retrofit2 okhttp