T
- the type of elements of the "actual" value.public class IterableAssert<T> extends AbstractIterableAssert<IterableAssert<T>,Iterable<? extends T>,T>
Iterable
.
To create an instance of this class, invoke
.
Assertions.assertThat(Iterable)
actual, info, myself
Modifier | Constructor and Description |
---|---|
protected |
IterableAssert(Iterable<? extends T> actual) |
protected |
IterableAssert(Iterator<? extends T> actual) |
Modifier and Type | Method and Description |
---|---|
IterableAssert<T> |
isExactlyInstanceOf(Class<?> type)
Verifies that the actual value is exactly an instance of the given type.
|
IterableAssert<T> |
isInstanceOf(Class<?> type)
Verifies that the actual value is an instance of the given type.
|
IterableAssert<T> |
isInstanceOfAny(Class<?>... types)
Verifies that the actual value is an instance of any of the given types.
|
IterableAssert<T> |
isNotExactlyInstanceOf(Class<?> type)
Verifies that the actual value is not exactly an instance of given type.
|
IterableAssert<T> |
isNotInstanceOf(Class<?> type)
Verifies that the actual value is not an instance of the given type.
|
IterableAssert<T> |
isNotInstanceOfAny(Class<?>... types)
Verifies that the actual value is not an instance of any of the given types.
|
IterableAssert<T> |
isNotOfAnyClassIn(Class<?>... types)
Verifies that the actual value type is not in given types.
|
IterableAssert<T> |
isOfAnyClassIn(Class<?>... types)
Verifies that the actual value type is in given types.
|
allMatch, are, areAtLeast, areAtLeastOne, areAtMost, areExactly, areNot, as, as, contains, containsAll, containsExactly, containsExactlyElementsOf, containsExactlyInAnyOrder, containsNull, containsOnly, containsOnlyElementsOf, containsOnlyOnce, containsSequence, containsSubsequence, describedAs, describedAs, doesNotContain, doesNotContainAnyElementsOf, doesNotContainNull, doesNotHave, doesNotHaveDuplicates, doesNotHaveSameClassAs, doNotHave, endsWith, extracting, extracting, extracting, extracting, extracting, extractingResultOf, extractingResultOf, filteredOn, filteredOn, filteredOn, filteredOn, filteredOnNull, flatExtracting, flatExtracting, has, hasAtLeastOneElementOfType, hasOnlyElementsOfType, hasSameClassAs, hasSameElementsAs, hasSameSizeAs, hasSameSizeAs, hasSize, hasToString, have, haveAtLeast, haveAtLeastOne, haveAtMost, haveExactly, inBinary, inHexadecimal, is, isEmpty, isEqualTo, isIn, isIn, isNot, isNotEmpty, isNotEqualTo, isNotIn, isNotIn, isNotNull, isNotSameAs, isNullOrEmpty, isSameAs, isSubsetOf, isSubsetOf, overridingErrorMessage, startsWith, usingComparator, usingComparisonStrategy, usingDefaultComparator, usingDefaultElementComparator, usingElementComparator, usingElementComparatorIgnoringFields, usingElementComparatorOnFields, usingFieldByFieldElementComparator, withFailMessage, withThreadDumpOnError
asList, asString, descriptionText, equals, failWithMessage, getWritableAssertionInfo, hashCode, isNull, matches, matches, throwAssertionError
public IterableAssert<T> isInstanceOf(Class<?> type)
AbstractAssert
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);
isInstanceOf
in interface Assert<IterableAssert<T>,Iterable<? extends T>>
isInstanceOf
in class AbstractIterableAssert<IterableAssert<T>,Iterable<? extends T>,T>
type
- the type to check the actual value against.public IterableAssert<T> isInstanceOfAny(Class<?>... types)
AbstractAssert
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);
isInstanceOfAny
in interface Assert<IterableAssert<T>,Iterable<? extends T>>
isInstanceOfAny
in class AbstractIterableAssert<IterableAssert<T>,Iterable<? extends T>,T>
types
- the types to check the actual value against.public IterableAssert<T> isOfAnyClassIn(Class<?>... types)
AbstractAssert
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);
isOfAnyClassIn
in interface Assert<IterableAssert<T>,Iterable<? extends T>>
isOfAnyClassIn
in class AbstractIterableAssert<IterableAssert<T>,Iterable<? extends T>,T>
types
- the types to check the actual value against.public IterableAssert<T> isExactlyInstanceOf(Class<?> type)
AbstractAssert
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);
isExactlyInstanceOf
in interface Assert<IterableAssert<T>,Iterable<? extends T>>
isExactlyInstanceOf
in class AbstractIterableAssert<IterableAssert<T>,Iterable<? extends T>,T>
type
- the type to check the actual value against.public IterableAssert<T> isNotInstanceOf(Class<?> type)
AbstractAssert
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);
isNotInstanceOf
in interface Assert<IterableAssert<T>,Iterable<? extends T>>
isNotInstanceOf
in class AbstractIterableAssert<IterableAssert<T>,Iterable<? extends T>,T>
type
- the type to check the actual value against.public IterableAssert<T> isNotInstanceOfAny(Class<?>... types)
AbstractAssert
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);
isNotInstanceOfAny
in interface Assert<IterableAssert<T>,Iterable<? extends T>>
isNotInstanceOfAny
in class AbstractIterableAssert<IterableAssert<T>,Iterable<? extends T>,T>
types
- the types to check the actual value against.public IterableAssert<T> isNotOfAnyClassIn(Class<?>... types)
AbstractAssert
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);
isNotOfAnyClassIn
in interface Assert<IterableAssert<T>,Iterable<? extends T>>
isNotOfAnyClassIn
in class AbstractIterableAssert<IterableAssert<T>,Iterable<? extends T>,T>
types
- the types to check the actual value against.public IterableAssert<T> isNotExactlyInstanceOf(Class<?> type)
AbstractAssert
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);
isNotExactlyInstanceOf
in interface Assert<IterableAssert<T>,Iterable<? extends T>>
isNotExactlyInstanceOf
in class AbstractIterableAssert<IterableAssert<T>,Iterable<? extends T>,T>
type
- the type to check the actual value against.Copyright © 2014–2016 AssertJ. All rights reserved.