Klitos Kyriacou
04/08/2026, 11:55 AMcollection1 shouldBe collection2
collection1 shouldContainExactly collection2
What are the pros and cons of each way of checking?CLOVIS
04/08/2026, 12:13 PMshouldContainExactly is better, as it lists which elements are different instead of just listing the two lists in their entirety.CLOVIS
04/08/2026, 12:14 PMLeoColman
04/08/2026, 12:40 PMshouldBe will use equality, while shouldContainExactly likely iterates over elementsKlitos Kyriacou
04/08/2026, 1:12 PMshouldBe forwards to IterableEq.equals so it's not just checking list equality. For example listOf(1,2) shouldBe setOf(1,2) is true whereas listOf(1,2) == setOf(1,2) is false. But Ivan is right, shouldContainExactly is better for large collections as it tells you which elements don't match.Alex Kuznetsov
04/09/2026, 8:35 PM