|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fest.assertions.internal.Lists
public class Lists
Reusable assertions for s.
List
| Constructor Summary | |
|---|---|
Lists(org.fest.util.ComparisonStrategy comparisonStrategy)
|
|
| Method Summary | |
|---|---|
void |
assertContains(AssertionInfo info,
List<?> actual,
Object value,
Index index)
Verifies that the given List contains the given object at the given index. |
void |
assertDoesNotContain(AssertionInfo info,
List<?> actual,
Object value,
Index index)
Verifies that the given List does not contain the given object at the given index. |
void |
assertIsSorted(AssertionInfo info,
List<?> actual)
Verifies that the actual list is sorted into ascending order according to the natural ordering of its elements. |
void |
assertIsSortedAccordingToComparator(AssertionInfo info,
List<?> actual,
Comparator<? extends Object> comparator)
Verifies that the actual list is sorted according to the given comparator. |
Comparator<?> |
getComparator()
|
static Lists |
instance()
Returns the singleton instance of this class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Lists(org.fest.util.ComparisonStrategy comparisonStrategy)
| Method Detail |
|---|
public static Lists instance()
public Comparator<?> getComparator()
public void assertContains(AssertionInfo info,
List<?> actual,
Object value,
Index index)
List contains the given object at the given index.
info - contains information about the assertion.actual - the given List.value - the object to look for.index - the index where the object should be stored in the given List.
AssertionError - if the given List is null or empty.
NullPointerException - if the given Index is null.
IndexOutOfBoundsException - if the value of the given Index is equal to or greater than the size of
the given List.
AssertionError - if the given List does not contain the given object at the given index.
public void assertDoesNotContain(AssertionInfo info,
List<?> actual,
Object value,
Index index)
List does not contain the given object at the given index.
info - contains information about the assertion.actual - the given List.value - the object to look for.index - the index where the object should be stored in the given List.
AssertionError - if the given List is null.
NullPointerException - if the given Index is null.
AssertionError - if the given List contains the given object at the given index.
public void assertIsSorted(AssertionInfo info,
List<?> actual)
All list elements must implement the Comparable interface and must be mutually comparable (that is,
e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the list), examples :
info - contains information about the assertion.actual - the given List.
AssertionError - if the actual list is not sorted into ascending order according to the natural ordering of
its elements.
AssertionError - if the actual list is null.
AssertionError - if the actual list element type does not implement Comparable.
AssertionError - if the actual list elements are not mutually Comparable.
public void assertIsSortedAccordingToComparator(AssertionInfo info,
List<?> actual,
Comparator<? extends Object> comparator)
info - contains information about the assertion.actual - the given List.comparator - the Comparator used to compare list elements
AssertionError - if the actual list is not sorted according to the given comparator.
AssertionError - if the actual list is null.
NullPointerException - if the given comparator is null.
AssertionError - if the actual list elements are not mutually comparabe according to given Comparator.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||