Class CollectionAssert<ELEMENT>
java.lang.Object
org.assertj.core.api.AbstractAssert<CollectionAssert<ELEMENT>, Collection<? extends ELEMENT>>
org.assertj.core.api.AbstractIterableAssert<CollectionAssert<ELEMENT>, Collection<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>>
org.assertj.core.api.AbstractCollectionAssert<CollectionAssert<ELEMENT>, Collection<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>>
org.assertj.core.api.CollectionAssert<ELEMENT>
- Type Parameters:
ELEMENT- the type of elements of the "actual" value.
- All Implemented Interfaces:
Assert<CollectionAssert<ELEMENT>, Collection<? extends ELEMENT>>, Descriptable<CollectionAssert<ELEMENT>>, EnumerableAssert<CollectionAssert<ELEMENT>, ELEMENT>, ExtensionPoints<CollectionAssert<ELEMENT>, Collection<? extends ELEMENT>>, ObjectEnumerableAssert<CollectionAssert<ELEMENT>, ELEMENT>
public class CollectionAssert<ELEMENT>
extends AbstractCollectionAssert<CollectionAssert<ELEMENT>, Collection<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>>
Assertion methods for
Collections.
To create an instance of this class, invoke .
Assertions.assertThat(Collection)
- Since:
- 3.21.0
-
Field Summary
Fields inherited from class AbstractIterableAssert
iterablesFields inherited from class AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> AbstractCollectionAssert<?, Collection<? extends E>, E, ObjectAssert<E>> assertThatCollection(Collection<? extends E> actual) protected CollectionAssert<ELEMENT> newAbstractIterableAssert(Iterable<? extends ELEMENT> iterable) This method is needed to build a new concrete instance of AbstractIterableAssert after a filtering operation is executed.protected ObjectAssert<ELEMENT> This method is used in navigating assertions likeAbstractIterableAssert.first(),AbstractIterableAssert.last()andAbstractIterableAssert.element(int)to build the assertion for the given element navigated to.Methods inherited from class AbstractCollectionAssert
isUnmodifiableMethods inherited from class AbstractIterableAssert
allMatch, allMatch, allSatisfy, allSatisfy, anyMatch, anyMatch, anySatisfy, anySatisfy, are, areAtLeast, areAtLeastOne, areAtMost, areExactly, areNot, as, as, contains, containsAll, containsAnyElementsOf, containsAnyOf, containsAnyOfForProxy, containsExactly, containsExactlyElementsOf, containsExactlyForProxy, containsExactlyInAnyOrder, containsExactlyInAnyOrderElementsOf, containsExactlyInAnyOrderForProxy, containsForProxy, containsNull, containsOnly, containsOnlyElementsOf, containsOnlyForProxy, containsOnlyNulls, containsOnlyOnce, containsOnlyOnceElementsOf, containsOnlyOnceForProxy, containsSequence, containsSequence, containsSequenceForProxy, containsSubsequence, containsSubsequence, containsSubsequenceForProxy, describedAs, describedAs, doesNotContain, doesNotContainAnyElementsOf, doesNotContainForProxy, doesNotContainNull, doesNotContainSequence, doesNotContainSequence, doesNotContainSequenceForProxy, doesNotContainSubsequence, doesNotContainSubsequence, doesNotContainSubsequenceForProxy, doesNotHave, doesNotHaveAnyElementsOfTypes, doesNotHaveDuplicates, doesNotHaveSameClassAs, doNotHave, element, element, elements, endsWith, endsWith, endsWithForProxy, extracting, extracting, extracting, extracting, extracting, extracting, extractingForProxy, extractingResultOf, extractingResultOf, filteredOn, filteredOn, filteredOn, filteredOn, filteredOn, filteredOnAssertions, filteredOnAssertions, filteredOnNull, first, first, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtractingForProxy, flatMap, flatMap, flatMap, flatMap, getComparatorsByType, getComparatorsForElementPropertyOrFieldTypes, has, hasAtLeastOneElementOfType, hasExactlyElementsOfTypes, hasOnlyElementsOfType, hasOnlyElementsOfTypes, hasOnlyOneElementSatisfying, hasSameClassAs, hasSameElementsAs, hasSameSizeAs, hasSameSizeAs, hasSize, hasSizeBetween, hasSizeGreaterThan, hasSizeGreaterThanOrEqualTo, hasSizeLessThan, hasSizeLessThanOrEqualTo, hasToString, have, haveAtLeast, haveAtLeastOne, haveAtMost, haveExactly, inBinary, inHexadecimal, is, isEmpty, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEmpty, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNullOrEmpty, isOfAnyClassIn, isSameAs, isSubsetOf, isSubsetOf, isSubsetOfForProxy, last, last, map, map, map, navigationDescription, newAbstractIterableAssertForProxy, noneMatch, noneMatch, noneSatisfy, noneSatisfy, overridingErrorMessage, satisfiesExactly, satisfiesExactly, satisfiesExactlyForProxy, satisfiesExactlyInAnyOrder, satisfiesExactlyInAnyOrder, satisfiesExactlyInAnyOrderForProxy, satisfiesOnlyOnce, satisfiesOnlyOnce, satisfiesOnlyOnceForProxy, singleElement, singleElement, size, startsWith, startsWithForProxy, usingComparator, usingComparator, usingComparatorForElementFieldsWithNames, usingComparatorForElementFieldsWithType, usingComparatorForType, usingComparisonStrategy, usingDefaultComparator, usingDefaultElementComparator, usingElementComparator, usingElementComparatorIgnoringFields, usingElementComparatorOnFields, usingFieldByFieldElementComparator, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison, usingRecursiveFieldByFieldElementComparator, usingRecursiveFieldByFieldElementComparator, usingRecursiveFieldByFieldElementComparatorIgnoringFields, usingRecursiveFieldByFieldElementComparatorOnFields, withFailMessage, withThreadDumpOnError, zipSatisfyMethods inherited from class AbstractAssert
actual, areEqual, asInstanceOf, asList, assertionError, asString, descriptionText, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, doesNotMatch, doesNotMatch, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, hashCode, hasSameHashCodeAs, hasToString, isElementOfCustomAssert, isInstanceOfSatisfying, isNull, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingEquals, usingEquals, withFailMessage, withRepresentationMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Descriptable
as, describedAs
-
Constructor Details
-
CollectionAssert
-
-
Method Details
-
assertThatCollection
public static <E> AbstractCollectionAssert<?, Collection<? extends E>, E, ObjectAssert<E>> assertThatCollection(Collection<? extends E> actual) -
toAssert
Description copied from class:AbstractIterableAssertThis method is used in navigating assertions likeAbstractIterableAssert.first(),AbstractIterableAssert.last()andAbstractIterableAssert.element(int)to build the assertion for the given element navigated to.Typical implementation is returning an
ObjectAssertbut it is possible to return a more specialized assertions should you know what type of elements the iterables contain.- Specified by:
toAssertin classAbstractIterableAssert<CollectionAssert<ELEMENT>, Collection<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>>- Parameters:
value- the element valuedescription- describes the element, ex: "check first element" forAbstractIterableAssert.first(), used in assertion description.- Returns:
- the assertion for the given element
-
newAbstractIterableAssert
Description copied from class:AbstractIterableAssertThis method is needed to build a new concrete instance of AbstractIterableAssert after a filtering operation is executed.If you create your own subclass of AbstractIterableAssert, simply returns an instance of it in this method.
- Specified by:
newAbstractIterableAssertin classAbstractIterableAssert<CollectionAssert<ELEMENT>, Collection<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>>- Parameters:
iterable- the iterable used to build the concrete instance of AbstractIterableAssert- Returns:
- concrete instance of AbstractIterableAssert
-