I tested the Rxjava
methods many times without problem but now i faced with this problem :
Null pointer exception
I think you are testing this in wrong way. Try this:
class ViewModelTest : BaseTest() {
private val mResponseBody = ResponseBody.create(
null, ""
)
private var mGson= Gson()
private val mRepository = mock()
@Test
fun registerPhone_success() {
whenever(mRepository.getRegister(any())).thenReturn(
Single.just(
Response.success(mResponseBody)
)
)
mViewModel.registerPhone("123", "123")
}
}