Skip to content

Commit 915c3ae

Browse files
author
joeretro
committed
Renamed Matcher.match(item) to Matcher.matches(item).
1 parent 05e35f2 commit 915c3ae

45 files changed

Lines changed: 100 additions & 98 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
*/
99
@SuppressWarnings({"UnusedDeclaration"})
1010
public interface Matcher<T> extends SelfDescribing {
11+
1112
/**
1213
* Evaluates the matcher for argument <var>item</var>.
1314
*
1415
* @param item the object against which the matcher is evaluated.
1516
* @return <code>true</code> if <var>item</var> matches, otherwise <code>false</code>.
1617
*/
17-
boolean match(Object item);
18+
boolean matches(Object item);
19+
1820
}

‎src/integration/org/hamcrest/MatcherAssert.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
public class MatcherAssert {
77

88
public static <T> void assertThat(T actual, Matcher<T> matcher) {
9-
if (!matcher.match(actual)) {
9+
if (!matcher.matches(actual)) {
1010
Description description = new StringDescription();
1111
description.appendText("\nExpected: ");
1212
matcher.describeTo(description);

‎src/integration/org/hamcrest/integration/EasyMockAdapter.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public EasyMockAdapter(Matcher matcher) {
3333

3434
@SuppressWarnings({"unchecked"})
3535
public boolean matches(Object argument) {
36-
return hamcrestMatcher.match(argument);
36+
return hamcrestMatcher.matches(argument);
3737
}
3838

3939
public void appendTo(StringBuffer buffer) {

‎src/integration/org/hamcrest/integration/JMockAdapter.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public JMockAdapter(Matcher matcher) {
2929

3030
@SuppressWarnings({"unchecked"})
3131
public boolean eval(Object o) {
32-
return hamcrestMatcher.match(o);
32+
return hamcrestMatcher.matches(o);
3333
}
3434

3535
public StringBuffer describeTo(StringBuffer buffer) {

‎src/library/org/hamcrest/Matchers.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class Matchers {
99
*/
1010
public static Matcher<String> isTwoXs() {
1111
return new TypeSafeMatcher<String>() {
12-
public boolean matchSafely(String string) {
12+
public boolean matchesSafely(String string) {
1313
return string.equals("xx");
1414
}
1515

‎src/library/org/hamcrest/TypeSafeMatcher.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ public abstract class TypeSafeMatcher<T> implements Matcher<T> {
1212
* Subclasses should implement this. The item will already have been checked for
1313
* the specific type and will never be null.
1414
*/
15-
protected abstract boolean matchSafely(T item);
15+
protected abstract boolean matchesSafely(T item);
1616

1717
/**
1818
* Method made final to prevent accidental override.
1919
* If you need to override this, there's no point on extending TypeSafeMatcher.
2020
* Instead, implement the Matcher interface directly.
2121
*/
2222
@SuppressWarnings({"unchecked"})
23-
public final boolean match(Object item) {
24-
return item != null && matchSafely((T) item);
23+
public final boolean matches(Object item) {
24+
return item != null && matchesSafely((T) item);
2525
}
2626

2727
}

‎src/library/org/hamcrest/beans/HasProperty.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public HasProperty(String propertyName) {
2626
this.propertyName = propertyName;
2727
}
2828

29-
public boolean matchSafely(T obj) {
29+
public boolean matchesSafely(T obj) {
3030
try {
3131
return PropertyUtil.getPropertyDescriptor(propertyName, obj) != null;
3232
} catch (IntrospectionException e) {

‎src/library/org/hamcrest/beans/HasPropertyWithValue.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
* If an exception is thrown by the getter method for a property, the property
5454
* does not exist, is not readable, or a reflection related exception is thrown
5555
* when trying to invoke it then this is treated as an evaluation failure and
56-
* the match method will return false.
56+
* the matches method will return false.
5757
* <p/>
5858
* This matcher class will also work with JavaBean objects that have explicit
5959
* bean descriptions via an associated BeanInfo description class. See the
@@ -77,11 +77,11 @@ public HasPropertyWithValue(String propertyName, Matcher value) {
7777
this.value = value;
7878
}
7979

80-
public boolean matchSafely(T argument) {
80+
public boolean matchesSafely(T argument) {
8181
try {
8282
Method readMethod = getReadMethod(argument);
8383
return readMethod != null
84-
&& value.match(readMethod.invoke(argument, NO_ARGUMENTS));
84+
&& value.matches(readMethod.invoke(argument, NO_ARGUMENTS));
8585
} catch (IntrospectionException e) {
8686
return false;
8787
} catch (IllegalArgumentException e) {

‎src/library/org/hamcrest/collection/IsArray.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ public IsArray(Matcher<T>[] elementMatchers) {
1313
this.elementMatchers = elementMatchers.clone();
1414
}
1515

16-
public boolean matchSafely(T[] array) {
16+
public boolean matchesSafely(T[] array) {
1717
if (array.length != elementMatchers.length) return false;
1818

1919
for (int i = 0; i < array.length; i++) {
20-
if (!elementMatchers[i].match(array[i])) return false;
20+
if (!elementMatchers[i].matches(array[i])) return false;
2121
}
2222

2323
return true;

‎src/library/org/hamcrest/collection/IsArrayContaining.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ public IsArrayContaining(Matcher<T> elementMatcher) {
1616
this.elementMatcher = elementMatcher;
1717
}
1818

19-
public boolean matchSafely(T[] array) {
19+
public boolean matchesSafely(T[] array) {
2020
int size = Array.getLength(array);
2121
for (int i = 0; i < size; i++) {
22-
if (elementMatcher.match(Array.get(array, i))) {
22+
if (elementMatcher.matches(Array.get(array, i))) {
2323
return true;
2424
}
2525
}

0 commit comments

Comments
 (0)