ListAssert.assertEquals should check size first, not last.
Otherwise, you get an ArrayIndexOutOfBoundsException
if expected is larger than actual.
Either that, or handle the above case where
expected.size() = 1, and actual.size() = 0;
The cause of the error is this line in failNotContains
(String message, List actual, Object value)
listcontent.append(actual.get(actual.size() - 1));
which falsely assumes that actual has a non-zero size.
Another solution would be to fix failNotContains to
handle a zero-sized actual List.
Log in to post a comment.