jjnair / fest

Automatically exported from code.google.com/p/fest
0 stars 0 forks source link

add isOrdered assertion to arrays/collections #315

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I would like to have a method on array and collection Assert classes that
asserts that the object's items are ordered.

For primitive arrays, the ordering is natural.  I would assume a signature
like FloatArrayAssert.isOrdered().  For Object arrays and collections, I
might do something like ObjectArrayAssert.isOrdered() that uses the natural
ordering and maybe another method ObjectArrayAssert.isOrdered(Comparator)
so that you can specify how to determine it is ordered.  One question is
what to do in ObjectArrayAssert.isOrdered() when one of the the objects
does not implement Comparable.  I would probably throw the assertion in
that case.

Original issue reported on code.google.com by geis....@gmail.com on 25 Aug 2009 at 6:01