Package org.fest.assertions
Class ItemGroupAssert<T>
java.lang.Object
org.fest.assertions.Assert
org.fest.assertions.GenericAssert<T>
org.fest.assertions.GroupAssert<T>
org.fest.assertions.ItemGroupAssert<T>
- Type Parameters:
T
- the type of object implementations of this template can verify.
- Direct Known Subclasses:
ArrayAssert
,ObjectGroupAssert
Understands a template for assertion methods related to groups of items (e.g. collections or arrays.)
- Since:
- 1.3
-
Field Summary
Fields inherited from class org.fest.assertions.GenericAssert
actual
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the actual value as aList
.Returns the actual value as aSet
.protected final void
assertContains
(Object... objects) Verifies that the actual actual group of objects contains the given objects, in any order.protected final void
assertContainsOnly
(Object... objects) Verifies that the actual group of objects contains the given objects only, in any order.protected final void
Verifies that the actual group of objects does not have duplicates.protected final void
assertExcludes
(Object... objects) Verifies that the actual group of objects does not contain the given objects.Returns a set containing all the elements in the given array.private AssertionError
failureIfExpectedElementsNotFound
(Collection<Object> notFound) private AssertionError
failureIfUnexpectedElementsFound
(Collection<Object> unexpected) private Collection<Object>
notFoundInActual
(Object... objects) notFoundInCopy
(Set<Object> copy, Set<Object> objects) protected final void
validateIsNotNull
(Object[] objects) Validates that the given array of objects is notnull
.Methods inherited from class org.fest.assertions.GroupAssert
actualGroupSize, as, as, assertHasSize, assertIsNotEmpty, describedAs, describedAs, hasSize, isEmpty, isNotEmpty, isNullOrEmpty, overridingErrorMessage
Methods inherited from class org.fest.assertions.GenericAssert
assertDoesNotSatisfy, assertEqualTo, assertIs, assertIsNot, assertNotEqualTo, assertNotNull, assertNotSameAs, assertSameAs, assertSatisfies, doesNotSatisfy, is, isEqualTo, isNot, isNotEqualTo, isNotNull, isNotSameAs, isNull, isSameAs, satisfies
Methods inherited from class org.fest.assertions.Assert
customErrorMessage, description, description, description, equals, fail, fail, failIfCustomMessageIsSet, failIfCustomMessageIsSet, failure, formattedErrorMessage, hashCode, rawDescription, replaceDefaultErrorMessagesWith
-
Constructor Details
-
ItemGroupAssert
Creates a newItemGroupAssert
.- Parameters:
actual
-
-
-
Method Details
-
assertContains
Verifies that the actual actual group of objects contains the given objects, in any order.- Parameters:
objects
- the objects to look for.- Throws:
AssertionError
- if the actual actual group of objects isnull
.NullPointerException
- if the given array isnull
.AssertionError
- if the actual actual group of objects does not contain the given objects.
-
notFoundInActual
-
assertContainsOnly
Verifies that the actual group of objects contains the given objects only, in any order.- Parameters:
objects
- the objects to look for.- Throws:
AssertionError
- if the actual group of objects isnull
.NullPointerException
- if the given group of objects isnull
.AssertionError
- if the actual group of objects does not contain the given objects, or if the actual group of objects contains elements other than the ones specified.
-
actualAsSet
Returns the actual value as aSet
.- Returns:
- the actual value as a
Set
.
-
asSet
Returns a set containing all the elements in the given array.- Parameters:
objects
- the given array.- Returns:
- a set containing all the elements in the given array.
-
notFoundInCopy
-
failureIfExpectedElementsNotFound
-
failureIfUnexpectedElementsFound
-
assertExcludes
Verifies that the actual group of objects does not contain the given objects.- Parameters:
objects
- the objects that the group of objects should exclude.- Throws:
AssertionError
- if the actual group of objects isnull
.NullPointerException
- if the given array isnull
.AssertionError
- if the actual group of objects contains any of the given objects.
-
validateIsNotNull
Validates that the given array of objects is notnull
.- Parameters:
objects
- the array of objects to verify.- Throws:
NullPointerException
- if the given array of objects isnull
.
-
assertDoesNotHaveDuplicates
protected final void assertDoesNotHaveDuplicates()Verifies that the actual group of objects does not have duplicates.- Throws:
AssertionError
- if the actual group of objects isnull
.AssertionError
- if the actual group of objects has duplicates.
-
actualAsList
Returns the actual value as aList
.- Returns:
- the actual value as a
List
.
-