| Modifier and Type | Method and Description |
|---|---|
| public void | describeMismatch(Object
The item that the Matcher has rejected. item, Description The description to be built or appended to. mismatchDescription)Overrides org. Implements org. |
| public void | describeTo(Description
The description to be built or appended to. description)Implements org. |
| public static <T> Matcher | |
| public static <T> Matcher | |
| public static <T> Matcher | |
| public static <T> Matcher | |
| public boolean | matches(Object
the object against which the matcher is evaluated. arg)Implements org. |
| matcher | back to summary |
|---|---|
| private final Matcher<T> matcher | |
| Is | back to summary |
|---|---|
| public Is(Matcher<T> matcher) | |
| describeMismatch | back to summary |
|---|---|
| public void describeMismatch(Object item, Description mismatchDescription) Overrides org. Implements org. Doc from org. Generate a description of why the matcher has not accepted the item.
The description will be part of a larger description of why a matching
failed, so it should be concise.
This method assumes that
| |
| describeTo | back to summary |
|---|---|
| public void describeTo(Description description) Implements org. Doc from org. Generates a description of the object. The description may be part of a a description of a larger object of which this is just a component, so it should be worded appropriately.
| |
| is | back to summary |
|---|---|
| public static <T> Matcher Decorates another Matcher, retaining its behaviour, but allowing tests to be slightly more expressive. For example: assertThat(cheese, is(equalTo(smelly)))instead of: assertThat(cheese, equalTo(smelly))
| |
| is | back to summary |
|---|---|
| public static <T> Matcher A shortcut to the frequently used For example: assertThat(cheese, is(smelly))instead of: assertThat(cheese, is(equalTo(smelly)))
| |
| is | back to summary |
|---|---|
| public static <T> Matcher Deprecated use isA(Class A shortcut to the frequently used For example: assertThat(cheese, is(Cheddar.class))instead of: assertThat(cheese, is(instanceOf(Cheddar.class)))
| |
| isA | back to summary |
|---|---|
| public static <T> Matcher A shortcut to the frequently used For example: assertThat(cheese, isA(Cheddar.class))instead of: assertThat(cheese, is(instanceOf(Cheddar.class)))
| |
| matches | back to summary |
|---|---|
| public boolean matches(Object arg) Implements org. Doc from org. Evaluates the matcher for argument item. This method matches against Object, instead of the generic type T. This is because the caller of the Matcher does not know at runtime what the type is (because of type erasure with Java generics). It is down to the implementations to check the correct type. | |