Fix NoSuchElementException thrown by containsSubList
Fix an edge case where calling containsSubList() throws a NoSuchElementException instead of an AssertionFailedError when the sublist is empty but the actual list is non-empty.
This was covered by unit tests, but they only verified that an exception was thrown, not the type of the exception. As such, I've specified the exception type via assertIs() which isn't used elsewhere in the codebase but seems appropriate to me. It's possible the general assertFails{} calls in unit tests should be replaced with a form that also checks the throwable type, to avoid this issue elsewhere.
Finally, it's my personal opinion that containsSubList() should not fail for this case, i.e. accept [] as a sublist of ["one", "two"]. That matches the behavior of startsWith() and my intuition, but given that there was a unit test for this behavior I've opted to leave it as-is in this PR.
It's possible the general assertFails{} calls in unit tests should be replaced with a form that also checks the throwable type, to avoid this issue elsewhere.
I think that's a good idea, feel free to submit a separate pr doing this, or I can when I have time.
Sounds good, I've submitted https://github.com/willowtreeapps/assertk/issues/410 to track. I'll probably take a stab at it today.
Finally, it's my personal opinion that containsSubList() should not fail for this case, i.e. accept [] as a sublist of ["one", "two"]. That matches the behavior of startsWith() and my intuition
I'm inclined to agree and would accept this behavior change.
Done, thanks!