T - The type of the collection elements.public class ExpectCollection<T> extends Object
Check for non-null Collection and provides further checks on the
actual collection in a fluent API.
| Constructor and Description |
|---|
ExpectCollection(Collection<T> actual)
Creates an instance for the non-null collection
actual. |
| Modifier and Type | Method and Description |
|---|---|
protected T |
check(boolean cond,
String msg,
Object... args) |
ExpectCollection<T> |
contains(T element)
Checks, that the collection contains the given element.
|
ExpectCollection<T> |
containsIdentical(T element)
Same as
contains(Object), but not using Object.equals(Object)
to compare the contained elements but the == operation. |
ExpectCollection<T> |
containsNot(T fragment)
Checks, that the collection does not contain the given element.
|
ExpectCollection<T> |
containsNotIdentical(T element)
Same as
containsNot(Object), but not using
Object.equals(Object) to compare the contained elements but the ==
operation. |
static <T> ExpectCollection<T> |
expectCollection(Collection<T> actual)
Check for non-null
Collection and provides further checks on the
actual collection in a fluent API. |
ExpectCollection<T> |
hasDuplicates(int expectedCount)
Check, that the collection has
count duplicates. |
ExpectCollection<T> |
hasNoDuplicates()
Check, that the collection has no duplicates.
|
ExpectCollection<T> |
hasSize(int expectedSize)
Checks, that the collection has the expected site.
|
ExpectCollection<T> |
isEmpty() |
public ExpectCollection(Collection<T> actual)
Creates an instance for the non-null collection actual.
actual - The Collection<T> to check.public static <T> ExpectCollection<T> expectCollection(Collection<T> actual)
Check for non-null Collection and provides further checks on the
actual collection in a fluent API.
actual - The Collection<T> to check.ExpectCollection to express further expectations on the
actual collection.ExpectCollectionpublic ExpectCollection<T> isEmpty()
public ExpectCollection<T> hasSize(int expectedSize)
Checks, that the collection has the expected site.
expectedSize - public ExpectCollection<T> hasDuplicates(int expectedCount)
Check, that the collection has count duplicates.
expectedCount - The number of expected duplicates.public ExpectCollection<T> hasNoDuplicates()
Check, that the collection has no duplicates.
public ExpectCollection<T> contains(T element)
Checks, that the collection contains the given element.
element - The element that must be contained in the collection.public ExpectCollection<T> containsIdentical(T element)
Same as contains(Object), but not using Object.equals(Object)
to compare the contained elements but the == operation.
element - The element that must be contained in the collection.public ExpectCollection<T> containsNot(T fragment)
Checks, that the collection does not contain the given element.
element - The element that must be not contained in the collection.public ExpectCollection<T> containsNotIdentical(T element)
Same as containsNot(Object), but not using
Object.equals(Object) to compare the contained elements but the ==
operation.
element - The element that must be contained in the collection.Copyright © 2019. All rights reserved.