Hi i am trying to mock one of my request response api to return a response success of type Void but i cant seem to do that as Void cannot be initialised and is private.
Im trying to do this:V
val responseMock = Response.success(Void())
But no joy.
I even tried setting the Response.success(null) and it complains that the responseMock object has to be of type Void in my case as my api method returns this:
Single<Response<Void>>
but having response.success(null) yields
Single<Response<Nothing?>>?
If defined in Kotlin, Single<Response<Void>>
is an impossible type. Void
can only be null
so the type has to be Single<Response<Void?>>
to make Response.success<Void?>(null)
a valid value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With