containsSubList

fun Assert<List<*>>.containsSubList(sublist: List<*>)

Asserts that a collection contains a subset of items the same order, but may have other items in the list.

Usages:

  • [] containsSubList [1,2,3] fails

  • [1,2,3] containsSubList [4,5,6] fails

  • [1,2,3] containsSubList [] pass

  • [] containsSubList [] pass

  • [1,2] containsSubList [1,2,3] pass

  • [2,3,4] containsSubList [1,2,3,4,5] pass

Parameters

sublist

The list of items the actual list should contain in the same order.