There is AbstractIterableAssert.containsSequence, but not the opposite to verify it doesn't contain sequence starting from any index.
Currently I'm using:
assertThat(myList).isNot(Condition(Predicate { it.containsSubList(mySubList) }, "containing sequence"))
where containsSubList is a Kotlin extension method I also had to define:
fun <T> List<T>.containsSubList(other: List<T>)
= (0..size - other.size).any { subList(it, it + other.size) == other }
I also suggest to create versions of both containsSequence and doesNotContainSequence that accepts List in addition to current vararg ELEMENT.
assertThat(myListOrIterable).doesNotContainSequence(mySubListOrIterable)
assertThat(myListOrIterable).doesNotContainSequence(element1, element2, element3)
assertThat(myListOrIterable).containsSequence(mySubListOrIterable)
NO
master branch2.x branchI've done a pull request for the "support Lists in the existing methods" half of your request.
I'll add the doesNotContainSequence methods separately.
I've added doesNotContainSequence but it still needs doesNotContainSubSequence.
Should all be there now.
Most helpful comment
I've done a pull request for the "support Lists in the existing methods" half of your request.
I'll add the
doesNotContainSequencemethods separately.