Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#13 ListAssert.assertEquals should check size first, not last

CVS_code
open
nobody
7
2004-08-16
2004-08-16
No

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.

Discussion

  • patch for ListAssert's failNotContains()

     
    • milestone: 230675 --> CVS_code
    • priority: 5 --> 7