Google Truth.assertThat.contains does not behave similar to List.contains

20 views Asked by At

Using List.containsAll() and Truth.assertThat(list).contains(originalList) behaves differently.

Working as expected

assertThat(getItemsByChannelId.containsAll(entitiesChannelAPage2)).isTrue()

Not working as expected

assertThat(getItemsByChannelId).contains(entitiesChannelAPage2)

I am trying to verify whether the list of data class returned from query on local db are the same set of items from what was previously inserted after performing some deletion. Is there something I am missing here or the first approach is the ideal solution for such validation? I was hoping to utilize Truth's API to the utmost specially to get a meaningful error message rather than the obscure expected to be true.

0

There are 0 answers