public class ContextMatcher<T>
extends org.hamcrest.BaseMatcher<T>
@Test
@Parameters
@TestCaseName("{method} {index} {params}")
public <T extends Comparable<T>> void compare(int expected, T x, T y) {
int result = Comp.compare(x, y);
assertThat(result, withContext(equalTo(expected), "x: " + x + "; y: " + y));
}
| Constructor and Description |
|---|
ContextMatcher(org.hamcrest.Matcher<T> matcher,
java.lang.String context) |
| Modifier and Type | Method and Description |
|---|---|
void |
describeMismatch(java.lang.Object item,
org.hamcrest.Description description) |
void |
describeTo(org.hamcrest.Description description) |
boolean |
matches(java.lang.Object obj) |
static <T> ContextMatcher<T> |
withContext(org.hamcrest.Matcher<T> matcher,
java.lang.String context)
Creates a context matcher.
|
static <T> ContextMatcher<T> |
withContext(java.lang.String context,
org.hamcrest.Matcher<T> matcher)
Creates a context matcher.
|
public ContextMatcher(org.hamcrest.Matcher<T> matcher, java.lang.String context)
public static <T> ContextMatcher<T> withContext(java.lang.String context, org.hamcrest.Matcher<T> matcher)
public static <T> ContextMatcher<T> withContext(org.hamcrest.Matcher<T> matcher, java.lang.String context)
public boolean matches(java.lang.Object obj)
public void describeTo(org.hamcrest.Description description)