`@Mock
private lateinit var firebaseAuth: FirebaseAuth
Код: Выделить всё
@InjectMocks
private lateinit var passwordLessSignInRepo: PasswordLessSignInRepo
@Before
fun setUp() {
MockitoAnnotations.openMocks(this)
}
val taskVoid: Task = mock()
whenever(taskVoid.isSuccessful).thenReturn(true)
whenever(firebaseAuth.sendSignInLinkToEmail("example@gmail.com", actionCodeSettings)).thenReturn(taskVoid)
val result = passwordLessSignInRepo.sendSignInLink("example@gmail.com")
assertEquals(Response.SUCCESS, result.response)`
Подробнее здесь: https://stackoverflow.com/questions/793 ... ot-be-null
Мобильная версия