You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MockWebServer.takeRequest() without parameters will block indefinitely if there is no request coming. In my opinion this is a bit unfortunate, because in case of e.g. a bug in our code which results in no calls being made, the complete test suite stalls. Another use case is when writing test-first code, then there is often no request yet programmed, yet I cannot run the test to assert that it is failing.
The solution is to use the overloaded method with an explicit timeout. But this makes the code less readable, and there are potentially many repetitions of the MockWebServer.takeRequest(xxx, SECONDS) (and similar) calls, which are basically noise.
This is why I want to suggest a feature to be able to set a default timeout, either per MockWebServer instance, or globally. Many test libraries like Awaitility or Mockito use static global variables for some baseline settings.
The text was updated successfully, but these errors were encountered:
MockWebServer.takeRequest()
without parameters will block indefinitely if there is no request coming. In my opinion this is a bit unfortunate, because in case of e.g. a bug in our code which results in no calls being made, the complete test suite stalls. Another use case is when writing test-first code, then there is often no request yet programmed, yet I cannot run the test to assert that it is failing.The solution is to use the overloaded method with an explicit timeout. But this makes the code less readable, and there are potentially many repetitions of the
MockWebServer.takeRequest(xxx, SECONDS)
(and similar) calls, which are basically noise.This is why I want to suggest a feature to be able to set a default timeout, either per
MockWebServer
instance, or globally. Many test libraries like Awaitility or Mockito use static global variables for some baseline settings.The text was updated successfully, but these errors were encountered: