Package org.assertj.core.api
Class ProxyableListAssert<ELEMENT>
- java.lang.Object
-
- org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
-
- org.assertj.core.api.AbstractIterableAssert<SELF,ACTUAL,ELEMENT,ELEMENT_ASSERT>
-
- org.assertj.core.api.AbstractListAssert<SELF,ACTUAL,ELEMENT,ELEMENT_ASSERT>
-
- org.assertj.core.api.FactoryBasedNavigableListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
-
- org.assertj.core.api.ProxyableListAssert<ELEMENT>
-
- All Implemented Interfaces:
Assert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>>,Descriptable<ProxyableListAssert<ELEMENT>>,EnumerableAssert<ProxyableListAssert<ELEMENT>,ELEMENT>,ExtensionPoints<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>>,IndexedObjectEnumerableAssert<ProxyableListAssert<ELEMENT>,ELEMENT>,ObjectEnumerableAssert<ProxyableListAssert<ELEMENT>,ELEMENT>
public class ProxyableListAssert<ELEMENT> extends FactoryBasedNavigableListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
Concrete assertions forLists without any final methods to allow proxying.- Since:
- 2.5.1 / 3.5.1
- Author:
- Gaƫl LHEZ
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classProxyableListAssert.ListFromStream<ELEMENT,STREAM extends BaseStream<ELEMENT,STREAM>>
-
Field Summary
-
Fields inherited from class org.assertj.core.api.AbstractListAssert
lists
-
Fields inherited from class org.assertj.core.api.AbstractIterableAssert
iterables
-
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, assertionErrorCreator, conditions, info, myself, objects, throwUnsupportedExceptionOnEquals
-
-
Constructor Summary
Constructors Modifier Constructor Description ProxyableListAssert(List<? extends ELEMENT> actual)protectedProxyableListAssert(DoubleStream actual)protectedProxyableListAssert(IntStream actual)protectedProxyableListAssert(LongStream actual)protectedProxyableListAssert(Stream<? extends ELEMENT> actual)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private AssertionErroractualDoesNotStartWithSequence(AssertionInfo info, Object[] sequence)private ProxyableListAssert.ListFromStreamasListFromStream()ProxyableListAssert<ELEMENT>isEqualTo(Object expected)Verifies that the actual value is equal to the given one.ProxyableListAssert<ELEMENT>isExactlyInstanceOf(Class<?> type)Verifies that the actual value is exactly an instance of the given type.ProxyableListAssert<ELEMENT>isInstanceOf(Class<?> type)Verifies that the actual value is an instance of the given type.ProxyableListAssert<ELEMENT>isInstanceOfAny(Class<?>... types)Verifies that the actual value is an instance of any of the given types.ProxyableListAssert<ELEMENT>isNotExactlyInstanceOf(Class<?> type)Verifies that the actual value is not exactly an instance of given type.ProxyableListAssert<ELEMENT>isNotInstanceOf(Class<?> type)Verifies that the actual value is not an instance of the given type.ProxyableListAssert<ELEMENT>isNotInstanceOfAny(Class<?>... types)Verifies that the actual value is not an instance of any of the given types.ProxyableListAssert<ELEMENT>isNotOfAnyClassIn(Class<?>... types)Verifies that the actual value type is not in given types.ProxyableListAssert<ELEMENT>isNotSameAs(Object expected)Verifies that the actual value is not the same as the given one, ie using == comparison.ProxyableListAssert<ELEMENT>isOfAnyClassIn(Class<?>... types)Verifies that the actual value type is in given types.ProxyableListAssert<ELEMENT>isSameAs(Object expected)Verifies that the actual value is the same as the given one, ie using == comparison.protected ProxyableListAssert<ELEMENT>newAbstractIterableAssert(Iterable<? extends ELEMENT> iterable)protected <ELEMENT2> AbstractListAssert<?,List<? extends ELEMENT2>,ELEMENT2,ObjectAssert<ELEMENT2>>newListAssertInstance(List<? extends ELEMENT2> newActual)Create aAbstractListAssert.ProxyableListAssert<ELEMENT>startsWith(ELEMENT... sequence)Verifies that the actual group starts with the given sequence of objects, without any other objects between them.-
Methods inherited from class org.assertj.core.api.FactoryBasedNavigableListAssert
toAssert
-
Methods inherited from class org.assertj.core.api.AbstractListAssert
as, as, contains, describedAs, describedAs, doesNotContain, doesNotHave, doesNotHaveSameClassAs, has, has, hasSameClassAs, hasToString, is, is, isIn, isIn, isNot, isNotEqualTo, isNotIn, isNotIn, isNotNull, isSorted, isSortedAccordingTo, overridingErrorMessage, satisfies, usingComparator, usingComparator, usingComparisonStrategy, usingDefaultComparator, usingDefaultElementComparator, usingElementComparator, withFailMessage, withThreadDumpOnError
-
Methods inherited from class org.assertj.core.api.AbstractIterableAssert
allMatch, allMatch, allSatisfy, anyMatch, anySatisfy, are, areAtLeast, areAtLeastOne, areAtMost, areExactly, areNot, contains, containsAll, containsAnyElementsOf, containsAnyOf, containsExactly, containsExactlyElementsOf, containsExactlyInAnyOrder, containsExactlyInAnyOrderElementsOf, containsNull, containsOnly, containsOnlyElementsOf, containsOnlyNulls, containsOnlyOnce, containsSequence, containsSequence, containsSubsequence, containsSubsequence, doesNotContain, doesNotContainAnyElementsOf, doesNotContainNull, doesNotContainSequence, doesNotContainSequence, doesNotContainSubsequence, doesNotContainSubsequence, doesNotHaveAnyElementsOfTypes, doesNotHaveDuplicates, doNotHave, element, endsWith, endsWith, extracting, extracting, extracting, extracting, extracting, extracting, extractingResultOf, extractingResultOf, filteredOn, filteredOn, filteredOn, filteredOn, filteredOnAssertions, filteredOnNull, first, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, flatExtracting, getComparatorsByType, getComparatorsForElementPropertyOrFieldTypes, hasAtLeastOneElementOfType, hasOnlyElementsOfType, hasOnlyElementsOfTypes, hasOnlyOneElementSatisfying, hasSameElementsAs, hasSameSizeAs, hasSameSizeAs, hasSize, hasSizeBetween, hasSizeGreaterThan, hasSizeGreaterThanOrEqualTo, hasSizeLessThan, hasSizeLessThanOrEqualTo, have, haveAtLeast, haveAtLeastOne, haveAtMost, haveExactly, inBinary, inHexadecimal, isEmpty, isNotEmpty, isNullOrEmpty, isSubsetOf, isSubsetOf, last, navigationDescription, noneMatch, noneSatisfy, size, usingComparatorForElementFieldsWithNames, usingComparatorForElementFieldsWithType, usingComparatorForType, usingElementComparatorIgnoringFields, usingElementComparatorOnFields, usingFieldByFieldElementComparator, usingRecursiveFieldByFieldElementComparator, withAssertionState, withComparatorsForElementPropertyOrFieldNames, withComparatorsForElementPropertyOrFieldTypes, withIterables, withTypeComparators, zipSatisfy
-
Methods inherited from class org.assertj.core.api.AbstractAssert
asInstanceOf, asList, asString, descriptionText, equals, failWithMessage, getWritableAssertionInfo, hashCode, hasSameHashCodeAs, isInstanceOfSatisfying, isNull, matches, matches, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, throwAssertionError, withRepresentation
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.assertj.core.api.EnumerableAssert
hasSameSizeAs, hasSameSizeAs, hasSize, hasSizeBetween, hasSizeGreaterThan, hasSizeGreaterThanOrEqualTo, hasSizeLessThan, hasSizeLessThanOrEqualTo, isEmpty, isNotEmpty, isNullOrEmpty
-
Methods inherited from interface org.assertj.core.api.ObjectEnumerableAssert
allMatch, allMatch, allSatisfy, anyMatch, anySatisfy, are, areAtLeast, areAtLeastOne, areAtMost, areExactly, areNot, contains, containsAll, containsAnyElementsOf, containsAnyOf, containsExactly, containsExactlyElementsOf, containsExactlyInAnyOrder, containsExactlyInAnyOrderElementsOf, containsNull, containsOnly, containsOnlyElementsOf, containsOnlyNulls, containsOnlyOnce, containsSequence, containsSequence, containsSubsequence, containsSubsequence, doesNotContain, doesNotContainAnyElementsOf, doesNotContainNull, doesNotContainSequence, doesNotContainSequence, doesNotContainSubsequence, doesNotContainSubsequence, doesNotHaveAnyElementsOfTypes, doesNotHaveDuplicates, doNotHave, endsWith, endsWith, hasAtLeastOneElementOfType, hasOnlyElementsOfType, hasOnlyElementsOfTypes, hasOnlyOneElementSatisfying, hasSameElementsAs, have, haveAtLeast, haveAtLeastOne, haveAtMost, haveExactly, isSubsetOf, isSubsetOf, noneMatch, noneSatisfy
-
-
-
-
Constructor Detail
-
ProxyableListAssert
protected ProxyableListAssert(IntStream actual)
-
ProxyableListAssert
protected ProxyableListAssert(LongStream actual)
-
ProxyableListAssert
protected ProxyableListAssert(DoubleStream actual)
-
-
Method Detail
-
newListAssertInstance
protected <ELEMENT2> AbstractListAssert<?,List<? extends ELEMENT2>,ELEMENT2,ObjectAssert<ELEMENT2>> newListAssertInstance(List<? extends ELEMENT2> newActual)
Description copied from class:AbstractAssertCreate aAbstractListAssert.Implementations need to redefine either to be proxy friendly (i.e. no final assertion methods like
ProxyableListAssert) or generic vararg friendly (to useSafeVarargsannotation which requires final method)likeListAssert.The default implementation will assume that this concrete implementation is NOT a soft assertion.
- Overrides:
newListAssertInstancein classAbstractAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>>- Type Parameters:
ELEMENT2- the type of elements.- Parameters:
newActual- new value- Returns:
- a new
AbstractListAssert.
-
newAbstractIterableAssert
protected ProxyableListAssert<ELEMENT> newAbstractIterableAssert(Iterable<? extends ELEMENT> iterable)
- Overrides:
newAbstractIterableAssertin classFactoryBasedNavigableListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
-
isEqualTo
public ProxyableListAssert<ELEMENT> isEqualTo(Object expected)
Description copied from class:AbstractAssertVerifies that the actual value is equal to the given one.Example:
// assertions will pass assertThat("abc").isEqualTo("abc"); assertThat(new HashMap<String, Integer>()).isEqualTo(new HashMap<String, Integer>()); // assertions will fail assertThat("abc").isEqualTo("123"); assertThat(new ArrayList<String>()).isEqualTo(1);- Specified by:
isEqualToin interfaceAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>>- Overrides:
isEqualToin classAbstractListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>- Parameters:
expected- the given value to compare the actual value to.- Returns:
thisassertion object.
-
isInstanceOf
public ProxyableListAssert<ELEMENT> isInstanceOf(Class<?> type)
Description copied from class:AbstractAssertVerifies that the actual value is an instance of the given type.Example:
// assertions will pass assertThat("abc").isInstanceOf(String.class); assertThat(new HashMap<String, Integer>()).isInstanceOf(HashMap.class); assertThat(new HashMap<String, Integer>()).isInstanceOf(Map.class); // assertions will fail assertThat(1).isInstanceOf(String.class); assertThat(new ArrayList<String>()).isInstanceOf(LinkedList.class);- Specified by:
isInstanceOfin interfaceAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>>- Overrides:
isInstanceOfin classAbstractListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>- Parameters:
type- the type to check the actual value against.- Returns:
- this assertion object.
-
isInstanceOfAny
public ProxyableListAssert<ELEMENT> isInstanceOfAny(Class<?>... types)
Description copied from class:AbstractAssertVerifies that the actual value is an instance of any of the given types.Example:
// assertions will pass assertThat("abc").isInstanceOfAny(String.class, Integer.class); assertThat(new ArrayList<String>()).isInstanceOfAny(LinkedList.class, ArrayList.class); assertThat(new HashMap<String, Integer>()).isInstanceOfAny(TreeMap.class, Map.class); // assertions will fail assertThat(1).isInstanceOfAny(Double.class, Float.class); assertThat(new ArrayList<String>()).isInstanceOfAny(LinkedList.class, Vector.class);- Specified by:
isInstanceOfAnyin interfaceAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>>- Overrides:
isInstanceOfAnyin classAbstractListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>- Parameters:
types- the types to check the actual value against.- Returns:
- this assertion object.
-
isOfAnyClassIn
public ProxyableListAssert<ELEMENT> isOfAnyClassIn(Class<?>... types)
Description copied from class:AbstractAssertVerifies that the actual value type is in given types.Example:
// assertions will pass assertThat(new HashMap<String, Integer>()).isOfAnyClassIn(HashMap.class, TreeMap.class); assertThat(new ArrayList<String>()).isOfAnyClassIn(ArrayList.class, LinkedList.class); // assertions will fail assertThat(new HashMap<String, Integer>()).isOfAnyClassIn(TreeMap.class, Map.class); assertThat(new ArrayList<String>()).isOfAnyClassIn(LinkedList.class, List.class);- Specified by:
isOfAnyClassInin interfaceAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>>- Overrides:
isOfAnyClassInin classAbstractListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>- Parameters:
types- the types to check the actual value against.- Returns:
- this assertion object.
-
isExactlyInstanceOf
public ProxyableListAssert<ELEMENT> isExactlyInstanceOf(Class<?> type)
Description copied from class:AbstractAssertVerifies that the actual value is exactly an instance of the given type.Example:
// assertions will pass assertThat("abc").isExactlyInstanceOf(String.class); assertThat(new ArrayList<String>()).isExactlyInstanceOf(ArrayList.class); assertThat(new HashMap<String, Integer>()).isExactlyInstanceOf(HashMap.class); // assertions will fail assertThat(1).isExactlyInstanceOf(String.class); assertThat(new ArrayList<String>()).isExactlyInstanceOf(List.class); assertThat(new HashMap<String, Integer>()).isExactlyInstanceOf(Map.class);- Specified by:
isExactlyInstanceOfin interfaceAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>>- Overrides:
isExactlyInstanceOfin classAbstractListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>- Parameters:
type- the type to check the actual value against.- Returns:
- this assertion object.
-
isNotInstanceOf
public ProxyableListAssert<ELEMENT> isNotInstanceOf(Class<?> type)
Description copied from class:AbstractAssertVerifies that the actual value is not an instance of the given type.Example:
// assertions will pass assertThat(1).isNotInstanceOf(Double.class); assertThat(new ArrayList<String>()).isNotInstanceOf(LinkedList.class); // assertions will fail assertThat("abc").isNotInstanceOf(String.class); assertThat(new HashMap<String, Integer>()).isNotInstanceOf(HashMap.class); assertThat(new HashMap<String, Integer>()).isNotInstanceOf(Map.class);- Specified by:
isNotInstanceOfin interfaceAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>>- Overrides:
isNotInstanceOfin classAbstractListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>- Parameters:
type- the type to check the actual value against.- Returns:
- this assertion object.
-
isNotInstanceOfAny
public ProxyableListAssert<ELEMENT> isNotInstanceOfAny(Class<?>... types)
Description copied from class:AbstractAssertVerifies that the actual value is not an instance of any of the given types.Example:
// assertions will pass assertThat(1).isNotInstanceOfAny(Double.class, Float.class); assertThat(new ArrayList<String>()).isNotInstanceOfAny(LinkedList.class, Vector.class); // assertions will fail assertThat(1).isNotInstanceOfAny(Double.class, Integer.class); assertThat(new ArrayList<String>()).isNotInstanceOfAny(LinkedList.class, ArrayList.class); assertThat(new HashMap<String, Integer>()).isNotInstanceOfAny(TreeMap.class, Map.class);- Specified by:
isNotInstanceOfAnyin interfaceAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>>- Overrides:
isNotInstanceOfAnyin classAbstractListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>- Parameters:
types- the types to check the actual value against.- Returns:
- this assertion object.
-
isNotOfAnyClassIn
public ProxyableListAssert<ELEMENT> isNotOfAnyClassIn(Class<?>... types)
Description copied from class:AbstractAssertVerifies that the actual value type is not in given types.Example:
// assertions will pass assertThat(new HashMap<String, Integer>()).isNotOfAnyClassIn(Map.class, TreeMap.class); assertThat(new ArrayList<String>()).isNotOfAnyClassIn(LinkedList.class, List.class); // assertions will fail assertThat(new HashMap<String, Integer>()).isNotOfAnyClassIn(HashMap.class, TreeMap.class); assertThat(new ArrayList<String>()).isNotOfAnyClassIn(ArrayList.class, LinkedList.class);- Specified by:
isNotOfAnyClassInin interfaceAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>>- Overrides:
isNotOfAnyClassInin classAbstractListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>- Parameters:
types- the types to check the actual value against.- Returns:
- this assertion object.
-
isNotExactlyInstanceOf
public ProxyableListAssert<ELEMENT> isNotExactlyInstanceOf(Class<?> type)
Description copied from class:AbstractAssertVerifies that the actual value is not exactly an instance of given type.Example:
// assertions will pass assertThat(1).isNotExactlyInstanceOf(String.class); assertThat(new ArrayList<String>()).isNotExactlyInstanceOf(List.class); assertThat(new HashMap<String, Integer>()).isNotExactlyInstanceOf(Map.class); // assertions will fail assertThat("abc").isNotExactlyInstanceOf(String.class); assertThat(new ArrayList<String>()).isNotExactlyInstanceOf(ArrayList.class); assertThat(new HashMap<String, Integer>()).isNotExactlyInstanceOf(HashMap.class);- Specified by:
isNotExactlyInstanceOfin interfaceAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>>- Overrides:
isNotExactlyInstanceOfin classAbstractListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>- Parameters:
type- the type to check the actual value against.- Returns:
- this assertion object.
-
isSameAs
public ProxyableListAssert<ELEMENT> isSameAs(Object expected)
Description copied from class:AbstractAssertVerifies that the actual value is the same as the given one, ie using == comparison.Example:
// Name is a class with first and last fields, two Names are equals if both first and last are equals. Name tyrion = new Name("Tyrion", "Lannister"); Name alias = tyrion; Name clone = new Name("Tyrion", "Lannister"); // assertions succeed: assertThat(tyrion).isSameAs(alias) .isEqualTo(clone); // assertion fails: assertThat(tyrion).isSameAs(clone);- Specified by:
isSameAsin interfaceAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>>- Overrides:
isSameAsin classAbstractListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>- Parameters:
expected- the given value to compare the actual value to.- Returns:
thisassertion object.
-
isNotSameAs
public ProxyableListAssert<ELEMENT> isNotSameAs(Object expected)
Description copied from class:AbstractAssertVerifies that the actual value is not the same as the given one, ie using == comparison.Example:
// Name is a class with first and last fields, two Names are equals if both first and last are equals. Name tyrion = new Name("Tyrion", "Lannister"); Name alias = tyrion; Name clone = new Name("Tyrion", "Lannister"); // assertions succeed: assertThat(clone).isNotSameAs(tyrion) .isEqualTo(tyrion); // assertion fails: assertThat(alias).isNotSameAs(tyrion);- Specified by:
isNotSameAsin interfaceAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>>- Overrides:
isNotSameAsin classAbstractListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>- Parameters:
expected- the given value to compare the actual value to.- Returns:
thisassertion object.
-
startsWith
public ProxyableListAssert<ELEMENT> startsWith(ELEMENT... sequence)
Description copied from class:AbstractIterableAssertVerifies that the actual group starts with the given sequence of objects, without any other objects between them. Similar to, but it also verifies that the first element in the sequence is also first element of the actual group.ObjectEnumerableAssert.containsSequence(Object...)Example:
// an Iterable is used in the example but it would also work with an array Iterable<String> abc = newArrayList("a", "b", "c"); // assertions will pass assertThat(abc).startsWith("a") .startsWith("a", "b"); // assertion will fail assertThat(abc).startsWith("c");- Specified by:
startsWithin interfaceObjectEnumerableAssert<ProxyableListAssert<ELEMENT>,ELEMENT>- Overrides:
startsWithin classAbstractIterableAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>- Parameters:
sequence- the sequence of objects to look for.- Returns:
- this assertion object.
-
actualDoesNotStartWithSequence
private AssertionError actualDoesNotStartWithSequence(AssertionInfo info, Object[] sequence)
-
asListFromStream
private ProxyableListAssert.ListFromStream asListFromStream()
-
-