Gabriel
11/06/2020, 11:16 PMopen class ImageListViewModel : ViewModel() {
private val _isLoading = MutableStateFlow(false)
val isLoading: StateFlow<Boolean>
get() = _isLoading
}
@Mock
lateinit var viewModel: ImageListViewModel
private val isLoading = MutableStateFlow(false)
@Test
fun imageListScreen() {
`when`(viewModel.isLoading).thenReturn(isLoading)
}
and then I get an error when running the test
org.mockito.exceptions.misusing.MissingMethodInvocationException:
when() requires an argument which has to be 'a method call on a mock'.