Class IterableSubject

java.lang.Object
com.qaitsolutions.pframe.core.assertion.subjects.Subject
com.qaitsolutions.pframe.core.assertion.subjects.IterableSubject

public final class IterableSubject extends Subject
Wrapper over IterableSubject.

Since:
1.0
Author:
Iulian Andrei (iulian.andrei@qaitsolutions.com)
  • Constructor Details

    • IterableSubject

      public IterableSubject(Iterable<?> actual, String message)
      Constructor for regular assertions.

      Parameters:
      actual - Current value to be verified.
      message - Description of the assertion.
    • IterableSubject

      public IterableSubject(Iterable<?> actual, String message, ErrorTracker tracker)
      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

      public void isEqualTo(Object expected)
      Description copied from class: Subject
      Fails if the subject is not equal to the given object. Wrapper over Subject.isEqualTo(Object).

      Overrides:
      isEqualTo in class Subject
      Parameters:
      expected - Value to be checked against.
    • isEmpty

      public void isEmpty()
      Fails if the subject is not empty. Wrapper over IterableSubject.isEmpty().
    • isNotEmpty

      public void isNotEmpty()
      Fails if the subject is empty. Wrapper over IterableSubject.isNotEmpty().
    • hasSize

      public void hasSize(int expectedSize)
      Fails if the subject does not have the given size. Wrapper over IterableSubject.hasSize(int).

      Parameters:
      expectedSize - Value to be verified against.
    • contains

      public void contains(Object element)
      Checks (with a side-effect failure) that the subject contains the supplied item. Wrapper over IterableSubject.contains(Object).

      Parameters:
      element - Value to be verified against.
    • doesNotContain

      public void doesNotContain(Object element)
      Checks (with a side-effect failure) that the subject does not contain the supplied item. Wrapper over IterableSubject.doesNotContain(Object).

      Parameters:
      element - Value to be verified against.
    • containsNoDuplicates

      public void containsNoDuplicates()
      Checks that the subject does not contain duplicate elements. Wrapper over IterableSubject.containsNoDuplicates().
    • containsAnyOf

      public void containsAnyOf(Object first, Object second, Object... rest)
      Checks that the subject contains at least one of the provided objects or fails. Wrapper over IterableSubject.containsAnyOf(Object, Object, Object...).

      Parameters:
      first - Value to be verified against.
      second - Value to be verified against.
      rest - Value to be verified against.
    • containsAnyIn

      public void containsAnyIn(Iterable<?> expected)
      Checks that the subject contains at least one of the objects contained in the provided collection or fails. Wrapper over IterableSubject.containsAnyIn(Iterable).

      Parameters:
      expected - Value to be verified against.
    • containsAnyIn

      public void containsAnyIn(Object[] expected)
      Checks that the subject contains at least one of the objects contained in the provided array or fails. Wrapper over IterableSubject.containsAnyIn(Object[]).

      Parameters:
      expected - Value to be verified against.
    • containsAtLeast

      public void containsAtLeast(Object firstExpected, Object secondExpected, Object... restOfExpected)
      Checks that the actual iterable contains at least all of the expected elements or fails. Wrapper over IterableSubject.containsAtLeast(Object, Object, Object...).

      Parameters:
      firstExpected - Value to be verified against.
      secondExpected - Value to be verified against.
      restOfExpected - Value to be verified against.
    • containsAtLeastElementsIn

      public void containsAtLeastElementsIn(Iterable<?> expectedIterable)
      Checks that the actual iterable contains at least all of the expected elements or fails. Wrapper over IterableSubject.containsAtLeastElementsIn(Iterable).

      Parameters:
      expectedIterable - Value to be verified against.
    • containsAtLeastElementsIn

      public void containsAtLeastElementsIn(Object[] expected)
      Checks that the actual iterable contains at least all of the expected elements or fails. Wrapper over IterableSubject.containsAtLeastElementsIn(Object[]).

      Parameters:
      expected - Value to be verified against.
    • containsExactly

      public void containsExactly(Object... varargs)
      Checks that a subject contains exactly the provided objects or fails. Wrapper over IterableSubject.containsExactly(Object...).

      Parameters:
      varargs - Value to be verified against.
    • containsExactlyElementsIn

      public void containsExactlyElementsIn(Iterable<?> expected)
      Checks that a subject contains exactly the provided objects or fails. Wrapper over IterableSubject.containsExactlyElementsIn(Iterable).

      Parameters:
      expected - Value to be verified against.
    • containsExactlyElementsIn

      public void containsExactlyElementsIn(Object[] expected)
      Checks that a subject contains exactly the provided objects or fails. Wrapper over IterableSubject.containsExactlyElementsIn(Object[]).

      Parameters:
      expected - Value to be verified against.
    • containsNoneOf

      public void containsNoneOf(Object firstExcluded, Object secondExcluded, Object... restOfExcluded)
      Checks that a actual iterable contains none of the excluded objects or fails. Wrapper over IterableSubject.containsNoneOf(Object, Object, Object...).

      Parameters:
      firstExcluded - Value to be verified against.
      secondExcluded - Value to be verified against.
      restOfExcluded - Value to be verified against.
    • containsNoneIn

      public void containsNoneIn(Iterable<?> excluded)
      Checks that the actual iterable contains none of the elements contained in the excluded iterable or fails. Wrapper over IterableSubject.containsNoneIn(Iterable).

      Parameters:
      excluded - Value to be verified against.
    • containsNoneIn

      public void containsNoneIn(Object[] excluded)
      Checks that the actual iterable contains none of the elements contained in the excluded array or fails. Wrapper over IterableSubject.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 over IterableSubject.isInStrictOrder().
    • isInStrictOrder

      public void isInStrictOrder(Comparator<?> comparator)
      Fails if the iterable is not strictly ordered, according to the given comparator. Wrapper over IterableSubject.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 over IterableSubject.isInOrder().
    • isInOrder

      public void isInOrder(Comparator<?> comparator)
      Fails if the iterable is not ordered, according to the given comparator. Wrapper over IterableSubject.isInOrder(Comparator).

      Parameters:
      comparator - Value to be verified against.