3
public class CustomTypeSafeMatcherTest extends AbstractMatcherTest {
4
private static final String STATIC_DESCRIPTION = "I match non empty strings";
5
private Matcher<String> customMatcher;
8
protected void setUp() throws Exception {
9
customMatcher = new CustomTypeSafeMatcher<String>(STATIC_DESCRIPTION) {
11
public boolean matchesSafely(String item) {
16
public void describeMismatchSafely(String item, Description mismatchDescription) {
17
mismatchDescription.appendText("an " + item);
22
public void testUsesStaticDescription() throws Exception {
23
assertDescription(STATIC_DESCRIPTION, customMatcher);
26
public void testReportsMismatch() {
27
assertMismatchDescription("an item", customMatcher, "item");
31
protected Matcher<?> createMatcher() {