We are testing something that uses OkHttp interceptors and came across an issue that we are not sure how to fix. We have this:
verify(chain).proceed(refEq(expectedRequest))
To make sure the Chain is called with the right request. However, this gives us a Type Mismatch warning because It expects a Request and not Request? as refEq returns.
The only thing that we have tried to do is to add !! at the end to remove the warning but that has woese consequences as it makes the tests fail with a KotlinNullPointerException. Which is understandable since Mockito returns null in their implementation.
Would it be as simple as using ?: createInstance() as it is done on other matchers?
We are testing something that uses
OkHttp
interceptors and came across an issue that we are not sure how to fix. We have this:To make sure the
Chain
is called with the right request. However, this gives us aType Mismatch
warning because It expects aRequest
and notRequest?
asrefEq
returns.The only thing that we have tried to do is to add
!!
at the end to remove the warning but that has woese consequences as it makes the tests fail with aKotlinNullPointerException
. Which is understandable sinceMockito
returnsnull
in their implementation.Would it be as simple as using
?: createInstance()
as it is done on other matchers?