Hello everybody, not sure if that may be a MockK issue, but let’s start posting here and let’s see 🙂
I have a mapper that maps from
LazyPagingItems
to my model/state (I do that in the presenter, using Molecule, if you’re wondering)
In order to test that, I created this convenience mock (since
LPI
has internal constructor)
fun <T : Any> mockLazyPagingItems(isEmpty: Boolean, refresh: LoadState): LazyPagingItems<T> = mockk {
every { loadState } returns mockk loadState@{
every { this@loadState.refresh } returns refresh
every { this@loadState.append } returns LoadState.Loading
every { this@loadState.prepend } returns LoadState.Loading
}
every { itemCount } returns if (isEmpty) 0 else 1
}
Updating to alpha19 I now have this exception (full stacktrace in thread)
java.lang.NullPointerException: Cannot invoke “androidx.compose.runtime.State.getValue()” because “$this$getValue$iv” is null
How would I fix that?