12
12
* new features and remain compatible with all Matcher implementations.
13
13
* </p>
14
14
* <p>
15
+ * When using Hamcrest, there is no guarantee as to how often <code>matches()</code> or
16
+ * <code>describeMismatch()</code> will be called, so the objects passed as
17
+ * <code>actual</code> arguments should not change when referenced. If you're testing a
18
+ * stream, a good practice is to collect the contents of the stream before matching.
19
+ * </p>
20
+ * <p>
15
21
* N.B. Well designed matchers should be immutable.
16
22
* </p>
17
23
*
@@ -27,12 +33,12 @@ public interface Matcher<T> extends SelfDescribing {
27
33
* (because of type erasure with Java generics). It is down to the implementations
28
34
* to check the correct type.
29
35
*
30
- * @param item the object against which the matcher is evaluated.
36
+ * @param actual the object against which the matcher is evaluated.
31
37
* @return <code>true</code> if <var>item</var> matches, otherwise <code>false</code>.
32
38
*
33
39
* @see BaseMatcher
34
40
*/
35
- boolean matches (Object item );
41
+ boolean matches (Object actual );
36
42
37
43
/**
38
44
* Generate a description of why the matcher has not accepted the item.
@@ -41,11 +47,11 @@ public interface Matcher<T> extends SelfDescribing {
41
47
* This method assumes that <code>matches(item)</code> is false, but
42
48
* will not check this.
43
49
*
44
- * @param item The item that the Matcher has rejected.
50
+ * @param actual The item that the Matcher has rejected.
45
51
* @param mismatchDescription
46
52
* The description to be built or appended to.
47
53
*/
48
- void describeMismatch (Object item , Description mismatchDescription );
54
+ void describeMismatch (Object actual , Description mismatchDescription );
49
55
50
56
/**
51
57
* This method simply acts a friendly reminder not to implement Matcher directly and
0 commit comments