Class IterableSubject
java.lang.Object
com.qaitsolutions.pframe.core.assertion.subjects.Subject
com.qaitsolutions.pframe.core.assertion.subjects.IterableSubject
Wrapper over
IterableSubject
.
- Since:
- 1.0
- Author:
- Iulian Andrei (iulian.andrei@qaitsolutions.com)
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionIterableSubject
(Iterable<?> actual, String message) Constructor for regular assertions.IterableSubject
(Iterable<?> actual, String message, ErrorTracker tracker) Constructor for soft assertions. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks (with a side-effect failure) that the subject contains the supplied item.void
containsAnyIn
(Iterable<?> expected) Checks that the subject contains at least one of the objects contained in the provided collection or fails.void
containsAnyIn
(Object[] expected) Checks that the subject contains at least one of the objects contained in the provided array or fails.void
containsAnyOf
(Object first, Object second, Object... rest) Checks that the subject contains at least one of the provided objects or fails.void
containsAtLeast
(Object firstExpected, Object secondExpected, Object... restOfExpected) Checks that the actual iterable contains at least all of the expected elements or fails.void
containsAtLeastElementsIn
(Iterable<?> expectedIterable) Checks that the actual iterable contains at least all of the expected elements or fails.void
containsAtLeastElementsIn
(Object[] expected) Checks that the actual iterable contains at least all of the expected elements or fails.void
containsExactly
(Object... varargs) Checks that a subject contains exactly the provided objects or fails.void
containsExactlyElementsIn
(Iterable<?> expected) Checks that a subject contains exactly the provided objects or fails.void
containsExactlyElementsIn
(Object[] expected) Checks that a subject contains exactly the provided objects or fails.void
Checks that the subject does not contain duplicate elements.void
containsNoneIn
(Iterable<?> excluded) Checks that the actual iterable contains none of the elements contained in the excluded iterable or fails.void
containsNoneIn
(Object[] excluded) Checks that the actual iterable contains none of the elements contained in the excluded array or fails.void
containsNoneOf
(Object firstExcluded, Object secondExcluded, Object... restOfExcluded) Checks that a actual iterable contains none of the excluded objects or fails.void
doesNotContain
(Object element) Checks (with a side-effect failure) that the subject does not contain the supplied item.void
hasSize
(int expectedSize) Fails if the subject does not have the given size.void
isEmpty()
Fails if the subject is not empty.void
Fails if the subject is not equal to the given object.void
Fails if the iterable is not ordered, according to the natural ordering of its elements.void
isInOrder
(Comparator<?> comparator) Fails if the iterable is not ordered, according to the given comparator.void
Fails if the iterable is not strictly ordered, according to the natural ordering of its elements.void
isInStrictOrder
(Comparator<?> comparator) Fails if the iterable is not strictly ordered, according to the given comparator.void
Fails if the subject is empty.Methods inherited from class com.qaitsolutions.pframe.core.assertion.subjects.Subject
isAnyOf, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs
-
Constructor Details
-
IterableSubject
Constructor for regular assertions.- Parameters:
actual
- Current value to be verified.message
- Description of the assertion.
-
IterableSubject
Constructor for soft assertions.- Parameters:
actual
- Current value to be verified.message
- Description of the assertion.tracker
- Entity which allows keeping track of existing errors.
-
-
Method Details
-
isEqualTo
Description copied from class:Subject
Fails if the subject is not equal to the given object. Wrapper overSubject.isEqualTo(Object)
. -
isEmpty
public void isEmpty()Fails if the subject is not empty. Wrapper overIterableSubject.isEmpty()
. -
isNotEmpty
public void isNotEmpty()Fails if the subject is empty. Wrapper overIterableSubject.isNotEmpty()
. -
hasSize
public void hasSize(int expectedSize) Fails if the subject does not have the given size. Wrapper overIterableSubject.hasSize(int)
.- Parameters:
expectedSize
- Value to be verified against.
-
contains
Checks (with a side-effect failure) that the subject contains the supplied item. Wrapper overIterableSubject.contains(Object)
.- Parameters:
element
- Value to be verified against.
-
doesNotContain
Checks (with a side-effect failure) that the subject does not contain the supplied item. Wrapper overIterableSubject.doesNotContain(Object)
.- Parameters:
element
- Value to be verified against.
-
containsNoDuplicates
public void containsNoDuplicates()Checks that the subject does not contain duplicate elements. Wrapper overIterableSubject.containsNoDuplicates()
. -
containsAnyOf
Checks that the subject contains at least one of the provided objects or fails. Wrapper overIterableSubject.containsAnyOf(Object, Object, Object...)
.- Parameters:
first
- Value to be verified against.second
- Value to be verified against.rest
- Value to be verified against.
-
containsAnyIn
Checks that the subject contains at least one of the objects contained in the provided collection or fails. Wrapper overIterableSubject.containsAnyIn(Iterable)
.- Parameters:
expected
- Value to be verified against.
-
containsAnyIn
Checks that the subject contains at least one of the objects contained in the provided array or fails. Wrapper overIterableSubject.containsAnyIn(Object[])
.- Parameters:
expected
- Value to be verified against.
-
containsAtLeast
Checks that the actual iterable contains at least all of the expected elements or fails. Wrapper overIterableSubject.containsAtLeast(Object, Object, Object...)
.- Parameters:
firstExpected
- Value to be verified against.secondExpected
- Value to be verified against.restOfExpected
- Value to be verified against.
-
containsAtLeastElementsIn
Checks that the actual iterable contains at least all of the expected elements or fails. Wrapper overIterableSubject.containsAtLeastElementsIn(Iterable)
.- Parameters:
expectedIterable
- Value to be verified against.
-
containsAtLeastElementsIn
Checks that the actual iterable contains at least all of the expected elements or fails. Wrapper overIterableSubject.containsAtLeastElementsIn(Object[])
.- Parameters:
expected
- Value to be verified against.
-
containsExactly
Checks that a subject contains exactly the provided objects or fails. Wrapper overIterableSubject.containsExactly(Object...)
.- Parameters:
varargs
- Value to be verified against.
-
containsExactlyElementsIn
Checks that a subject contains exactly the provided objects or fails. Wrapper overIterableSubject.containsExactlyElementsIn(Iterable)
.- Parameters:
expected
- Value to be verified against.
-
containsExactlyElementsIn
Checks that a subject contains exactly the provided objects or fails. Wrapper overIterableSubject.containsExactlyElementsIn(Object[])
.- Parameters:
expected
- Value to be verified against.
-
containsNoneOf
Checks that a actual iterable contains none of the excluded objects or fails. Wrapper overIterableSubject.containsNoneOf(Object, Object, Object...)
.- Parameters:
firstExcluded
- Value to be verified against.secondExcluded
- Value to be verified against.restOfExcluded
- Value to be verified against.
-
containsNoneIn
Checks that the actual iterable contains none of the elements contained in the excluded iterable or fails. Wrapper overIterableSubject.containsNoneIn(Iterable)
.- Parameters:
excluded
- Value to be verified against.
-
containsNoneIn
Checks that the actual iterable contains none of the elements contained in the excluded array or fails. Wrapper overIterableSubject.containsNoneIn(Object[])
.- Parameters:
excluded
- Value to be verified against.
-
isInStrictOrder
public void isInStrictOrder()Fails if the iterable is not strictly ordered, according to the natural ordering of its elements. Wrapper overIterableSubject.isInStrictOrder()
. -
isInStrictOrder
Fails if the iterable is not strictly ordered, according to the given comparator. Wrapper overIterableSubject.isInStrictOrder(Comparator)
.- Parameters:
comparator
- Value to be verified against.
-
isInOrder
public void isInOrder()Fails if the iterable is not ordered, according to the natural ordering of its elements. Wrapper overIterableSubject.isInOrder()
. -
isInOrder
Fails if the iterable is not ordered, according to the given comparator. Wrapper overIterableSubject.isInOrder(Comparator)
.- Parameters:
comparator
- Value to be verified against.
-