Class DelegatingMatcher<T,U>

java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeMatcher<T>
com.atlassian.jira.plugins.ha.testapi.matchers.DelegatingMatcher<T,U>
Type Parameters:
T - The subject type of the new matcher.
U - The subject type of the original delegate matcher.
All Implemented Interfaces:
org.hamcrest.Matcher<T>, org.hamcrest.SelfDescribing

public class DelegatingMatcher<T,U> extends org.hamcrest.TypeSafeMatcher<T>
Generic helper class to compose custom matchers.

Given a matcher that accepts a type U, constructs a matcher that accepts a type T where T is some type that can access a U.

For example, given that U is a type UpgradeState, and T is a type ClusterNode, we can create a matcher that accepts a ClusterNode by providing 1) a matcher that accepts an UpgradeState; and 2) a function that maps a ClusterNode on to an Upgrade State.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    describeMismatchSafely(T item, org.hamcrest.Description mismatchDescription)
     
    void
    describeTo(org.hamcrest.Description description)
     
    protected boolean
    matchesSafely(T subject)
     
    static final <T, U> org.hamcrest.TypeSafeMatcher<T>
    matchWithDelegate(Function<T,U> valueSupplier, org.hamcrest.Matcher<U> delegateMatcher)
     

    Methods inherited from class org.hamcrest.TypeSafeMatcher

    describeMismatch, matches

    Methods inherited from class org.hamcrest.BaseMatcher

    _dont_implement_Matcher___instead_extend_BaseMatcher_, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • matchWithDelegate

      public static final <T, U> org.hamcrest.TypeSafeMatcher<T> matchWithDelegate(Function<T,U> valueSupplier, org.hamcrest.Matcher<U> delegateMatcher)
    • matchesSafely

      protected boolean matchesSafely(T subject)
      Specified by:
      matchesSafely in class org.hamcrest.TypeSafeMatcher<T>
    • describeTo

      public void describeTo(org.hamcrest.Description description)
    • describeMismatchSafely

      protected void describeMismatchSafely(T item, org.hamcrest.Description mismatchDescription)
      Overrides:
      describeMismatchSafely in class org.hamcrest.TypeSafeMatcher<T>