CustomMatcher (Hamcrest)
Date: 2012-07-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hamcrest
Class CustomMatcher<T>

    java.lang.Object
      org.hamcrest.BaseMatcher<T>
          org.hamcrest.CustomMatcher<T>

Type Parameters:
  `T` - The type of object being matched.

All Implemented Interfaces:
  Matcher<T>, SelfDescribing

    public abstract class CustomMatcher<T>

extends BaseMatcher<T>

Utility class for writing one off matchers. For example:

     Matcher<String> aNonEmptyString = new CustomMatcher<String>("a non empty string") {
       public boolean matches(Object object) {
         return ((object instanceof String) && !((String) object).isEmpty();
       }
     };

This class is designed for scenarios where an anonymous inner class matcher makes sense. It should not be used by API designers implementing matchers.

Author:
  Neil Dunn
See Also:
  `for a type safe variant of this class that you probably want to use.`

Constructor Summary
`CustomMatcher(java.lang.String description)`

Method Summary
`void` | `describeTo(Description description)` Generates a description of the object.

Methods inherited from class org.hamcrest.BaseMatcher
`_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.hamcrest.Matcher
`matches`

Constructor Detail

### CustomMatcher

    public CustomMatcher(java.lang.String description)

Method Detail

### describeTo

    public final void describeTo(Description description)

  Description copied from interface: `SelfDescribing`
  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.

  Parameters:
    `description` - The description to be built or appended to.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD