Class ObjectChecker<T>

java.lang.Object
org.immutables.check.ObjectChecker<T>
Type Parameters:
T - the generic type
Direct Known Subclasses:
IterableChecker, StringChecker

public class ObjectChecker<T> extends Object
The match wrapper.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) final T
     
    (package private) final boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ObjectChecker(T actualValue, boolean negate)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    allOf(org.hamcrest.Matcher<? super T>... matchers)
    Evaluates to true only if ALL of the passed in matchers evaluate to true.
    final void
    anyOf(org.hamcrest.Matcher<? super T>... matchers)
    Evaluates to true if ANY of the passed in matchers evaluate to true.
    void
    This matcher always evaluates to true.
     
    protected void
     
    boolean
    Deprecated.
    You probably want to use is(Object) method for matcher wrapper.
    (package private) static void
    fail(Object actualValue, org.hamcrest.Matcher<?> matcher)
     
    int
    Deprecated.
    This class should not be used with collections
    void
    hasToString(String expectedToStringValue)
     
    void
    is(org.hamcrest.Matcher<? super T> matcher)
     
    void
    is(T value)
    This is equal to check
    void
    isA(Class<?> type)
    Is the value an instance of a particular type?.
    void
    isIn(Collection<T> values)
     
    final void
    isIn(T... values)
     
    void
     
    not()
    Makes checker negative.
    void
    not(org.hamcrest.Matcher<? super T> matcher)
    Inverts the rule.
    void
    not(T value)
     
    void
     
    void
    same(T object)
    Creates a new instance of IsSame
    void
    satisfies(com.google.common.base.Predicate<? super T> predicate)
     
    (package private) static StackTraceElement[]
     
    (package private) static void
    verifyCheck(String description, boolean assertionState)
     
    protected void
    verifyUsingMatcher(org.hamcrest.Matcher<? super T> matcher)
     
    (package private) static <Z> void
    verifyUsingMatcher(Z actualValue, org.hamcrest.Matcher<? super Z> matcher)
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • actualValue

      @Nullable final T actualValue
    • negate

      final boolean negate
  • Constructor Details

    • ObjectChecker

      ObjectChecker(@Nullable T actualValue, boolean negate)
  • Method Details

    • fail

      static void fail(@Nullable Object actualValue, org.hamcrest.Matcher<?> matcher)
    • trimStackTrace

      static StackTraceElement[] trimStackTrace(StackTraceElement[] stackTrace)
    • verifyCheck

      static void verifyCheck(String description, boolean assertionState)
    • verifyUsingMatcher

      static <Z> void verifyUsingMatcher(@Nullable Z actualValue, org.hamcrest.Matcher<? super Z> matcher)
    • equals

      @Deprecated public boolean equals(Object any)
      Deprecated.
      You probably want to use is(Object) method for matcher wrapper.
      Deprecated to prevent accidental usage of this method.
      Overrides:
      equals in class Object
      Parameters:
      any - object
      Returns:
      nothing
    • allOf

      @SafeVarargs public final void allOf(org.hamcrest.Matcher<? super T>... matchers)
      Evaluates to true only if ALL of the passed in matchers evaluate to true.
      Parameters:
      matchers - the matchers
    • anyOf

      @SafeVarargs public final void anyOf(org.hamcrest.Matcher<? super T>... matchers)
      Evaluates to true if ANY of the passed in matchers evaluate to true.
      Parameters:
      matchers - the matchers
    • anything

      public void anything()
      This matcher always evaluates to true.
    • asString

      public StringChecker asString()
    • hasToString

      public void hasToString(String expectedToStringValue)
    • is

      public void is(org.hamcrest.Matcher<? super T> matcher)
    • is

      public void is(@Nullable T value)
      This is equal to check
      Parameters:
      value - the value
    • isA

      public void isA(Class<?> type)
      Is the value an instance of a particular type?.
      Parameters:
      type - the type
    • isNull

      public void isNull()
    • not

      public void not(org.hamcrest.Matcher<? super T> matcher)
      Inverts the rule.
      Parameters:
      matcher - the matcher
    • not

      public ObjectChecker<T> not()
      Makes checker negative.
      Returns:
      negative checker
    • ensureNonNegative

      protected void ensureNonNegative()
    • not

      public void not(@Nullable T value)
    • notNull

      public void notNull()
    • same

      public void same(T object)
      Creates a new instance of IsSame
      Parameters:
      object - The predicate evaluates to true only when the argument is this object.
    • isIn

      public void isIn(Collection<T> values)
    • isIn

      @SafeVarargs public final void isIn(T... values)
    • satisfies

      public void satisfies(com.google.common.base.Predicate<? super T> predicate)
    • verifyUsingMatcher

      protected void verifyUsingMatcher(org.hamcrest.Matcher<? super T> matcher)
    • hashCode

      @Deprecated public int hashCode()
      Deprecated.
      This class should not be used with collections
      Overrides:
      hashCode in class Object