Skip to content

Commit e48d2ae

Browse files
author
npryce
committed
Factored SelfDescribing interface out of Matcher<T>
1 parent 71090b6 commit e48d2ae

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

‎src/api/org/hamcrest/Matcher.java‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,15 @@
33
package org.hamcrest;
44

55
/**
6-
* A matcher over acceptable values. A matcher should be able to describe itself to give feedback when it fails.
6+
* A matcher over acceptable values.
7+
* A matcher is able to describe itself to give feedback when it fails.
78
*/
8-
public interface Matcher<T> {
9+
public interface Matcher<T> extends SelfDescribing {
910
/**
1011
* Evaluates the matcher for argument <var>item</var>.
1112
*
1213
* @param item the object against which the matcher is evaluated.
1314
* @return <code>true</code> if <var>item</var> matches, otherwise <code>false</code>.
1415
*/
1516
boolean match(T item);
16-
17-
/**
18-
* Describes this matcher.
19-
*/
20-
void describeTo(Description description);
2117
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.hamcrest;
2+
3+
/**
4+
* The ability of an object to describe itself.
5+
*/
6+
public interface SelfDescribing {
7+
/**
8+
* Generates a description of the object. The description may be part of a
9+
* a description of a larger object of which this is just a component, so it
10+
* should be worded appropriately.
11+
*
12+
* @param description
13+
* The description to be built or appended to.
14+
*/
15+
void describeTo(Description description);
16+
}

0 commit comments

Comments
 (0)