strikt
strikt copied to clipboard
Add assertion for a non-continuous sequence in an Iterable
This is a request for a new assertion which checks whether the subject Iterable contains the given elements in order provided, possibly with other items between them. AssertJ has that feature: containsSubsequence(ELEMENT... sequence), though I'm not a fan of that name. I'd call it either containsNonContinuousSequence
or containsInOrder
(as opposed to just contains
, which doesn't verify the order and containsExactly
, which checks the order, but doesn't allow other items).
This was already raised in #156 but the closing PR resolved only half of that feature request. Additionally, that PR implemented containsSequence
on Lists, but I think it'd make more sense to implement that more broadly on Iterables.
I could try implementing this if that's okay.