java.lang.Object
com.qaitsolutions.pframe.core.assertion.subjects.Subject
Direct Known Subclasses:
BooleanSubject, ComparableSubject, IterableSubject, MapSubject

public class Subject extends Object
Wrapper over Subject.

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

  • Constructor Details

    • Subject

      public Subject(Object actual, String message)
      Constructor for regular assertions.

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

      public Subject(Object 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

    • isNull

      public void isNull()
      Fails if the subject is not null. Wrapper over Subject.isNull().
    • isNotNull

      public void isNotNull()
      Fails if the subject is null. Wrapper over Subject.isNotNull().
    • isEqualTo

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

      Parameters:
      expected - Value to be checked against.
    • isNotEqualTo

      public void isNotEqualTo(Object unexpected)
      Fails if the subject is equal to the given object. The meaning of equality is the same as for the isEqualTo(java.lang.Object) method. Wrapper over Subject.isNotEqualTo(Object).

      Parameters:
      unexpected - Value to be checked against.
    • isSameInstanceAs

      public void isSameInstanceAs(Object expected)
      Fails if the subject is not the same instance as the given object. Wrapper over Subject.isSameInstanceAs(Object).

      Parameters:
      expected - Value to be checked against.
    • isNotSameInstanceAs

      public void isNotSameInstanceAs(Object unexpected)
      Fails if the subject is the same instance as the given object. Wrapper over Subject.isNotSameInstanceAs(Object).

      Parameters:
      unexpected - Value to be checked against.
    • isInstanceOf

      public void isInstanceOf(Class<?> clazz)
      Fails if the subject is not an instance of the given class. Wrapper over Subject.isInstanceOf(Class).

      Parameters:
      clazz - Value to be checked against.
    • isNotInstanceOf

      public void isNotInstanceOf(Class<?> clazz)
      Fails if the subject is an instance of the given class. Wrapper over Subject.isNotInstanceOf(Class).

      Parameters:
      clazz - Value to be checked against.
    • isIn

      public void isIn(Iterable<?> iterable)
      Fails unless the subject is equal to any element in the given iterable. Wrapper over Subject.isIn(Iterable).

      Parameters:
      iterable - Value to be checked against.
    • isAnyOf

      public void isAnyOf(Object first, Object second, Object... rest)
      Fails unless the subject is equal to any of the given elements. Wrapper over Subject.isAnyOf(Object, Object, Object...).

      Parameters:
      first - Value to be checked against.
      second - Value to be checked against.
      rest - Value to be checked against.
    • isNotIn

      public void isNotIn(Iterable<?> iterable)
      Fails if the subject is equal to any element in the given iterable. Wrapper over Subject.isNotIn(Iterable).

      Parameters:
      iterable - Value to be checked against.
    • isNoneOf

      public void isNoneOf(Object first, Object second, Object... rest)
      Fails if the subject is equal to any of the given elements. Wrapper over Subject.isNoneOf(Object, Object, Object...).

      Parameters:
      first - Value to be checked against.
      second - Value to be checked against.
      rest - Value to be checked against.