Robolectric + rxJava + retrofit Second call throws java.io.InterruptedIOException

心已入冬 提交于 2019-12-03 14:52:23

I think you're doing a little too much to get observables to run synchronously during testing. Instead all you need to do is during your test

 Book book = retrofitAPI.getBook(someId).toBlocking.first()

This would execute the observable synchronously. One of my favorite parts of the Rx library.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!