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 TypeMethodDescriptionprotected voiddescribeMismatchSafely(T item, org.hamcrest.Description mismatchDescription) voiddescribeTo(org.hamcrest.Description description) protected booleanmatchesSafely(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, matchesMethods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
-
Method Details
-
matchWithDelegate
public static final <T,U> org.hamcrest.TypeSafeMatcher<T> matchWithDelegate(Function<T, U> valueSupplier, org.hamcrest.Matcher<U> delegateMatcher) -
matchesSafely
- Specified by:
matchesSafelyin classorg.hamcrest.TypeSafeMatcher<T>
-
describeTo
public void describeTo(org.hamcrest.Description description) -
describeMismatchSafely
- Overrides:
describeMismatchSafelyin classorg.hamcrest.TypeSafeMatcher<T>
-