pp.amorim
07/22/2020, 5:59 PMList.take(n)
and I setup the iterator
of the mocked list and populated it. I thought it could be enough, but I am getting NPE.
`when`(mockedList.iterator()).thenReturn(list.iterator())
I noticed that take
creates a new arraylist by doing val list = ArrayList<T>(n)
. could be the problem here?natpryce
07/22/2020, 6:00 PMnatpryce
07/22/2020, 6:01 PMpp.amorim
07/22/2020, 6:01 PMpp.amorim
07/22/2020, 6:01 PMnatpryce
07/22/2020, 6:01 PMnatpryce
07/22/2020, 6:02 PMpp.amorim
07/22/2020, 6:02 PMpp.amorim
07/22/2020, 6:02 PMnatpryce
07/22/2020, 6:02 PMpp.amorim
07/22/2020, 6:03 PMtake
Tobias Berger
07/22/2020, 8:30 PM.take(n)
calls the size
property of your mock, which might return null.
But what exactly keeps you from just creating an instance of RealmList with one of the constructors that are documented on the page you posted?Tobias Berger
07/22/2020, 8:34 PM