We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm testing service with runBlockingTest but not work, But if use runBlocking instead runBlockingTest it's work
error when use runBlockingTest java.lang.IllegalStateException: This job has not completed yet
java.lang.IllegalStateException: This job has not completed yet
my code
class ServiceTest { @get:Rule val mainCoroutineRule = MainCoroutineRule() @get:Rule val instantExecutorRule = InstantTaskExecutorRule() private var mockWebServer = MockWebServer() private lateinit var service: Service @Before fun setup() { mockWebServer.start() service = Retrofit.Builder() .baseUrl(mockWebServer.url("/")) .addConverterFactory(GsonConverterFactory.create()) .build() .create(Service::class.java) } @After fun tearDown() { mockWebServer.shutdown() } @Test(expected = HttpException::class) fun testService() { val mockResponse = MockResponse().setResponseCode(HttpURLConnection.HTTP_BAD_GATEWAY) mockWebServer.enqueue(mockResponse) mainCoroutineRule.runBlockingTest { val response = service.testService() } }
The text was updated successfully, but these errors were encountered:
Probably related: Kotlin/kotlinx.coroutines#1204
Sorry, something went wrong.
Yep, that's it. Can't be fixed by us. We use threads (or, more specifically, OkHttp does) to perform work asynchronously from the caller.
No branches or pull requests
I'm testing service with runBlockingTest but not work, But if use runBlocking instead runBlockingTest it's work
error when use runBlockingTest
java.lang.IllegalStateException: This job has not completed yet
my code
The text was updated successfully, but these errors were encountered: