https://kotlinlang.org logo
#compose
Title
# compose
g

Gabriel

11/04/2020, 8:50 AM
Hey folks, I'm using mockito to mock a viewmodel and then return certain values
Copy code
@Mock
lateinit var viewModel: ImageListViewModel
...

`when`(viewModel.imageItems).thenReturn(listOf())
but doing this gives me an error:
Copy code
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object androidx.compose.runtime.State.getValue()' on a null object reference
where imageItems is
Copy code
var imageItems: List<ImageItem> by mutableStateOf(listOf())
	private set
would anyone know what I'm doing wrong?
I'm asking in here because I think
mutableStateOf
is something that's come about because of compose?
12 Views