Skip to content

Commit bee7260

Browse files
author
joeretro
committed
Renamed eq() -> equalTo(). Renamed IsCloseTo.eq() to closeTo()
1 parent be4002d commit bee7260

23 files changed

Lines changed: 123 additions & 119 deletions

‎TODO.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,8 @@
3535

3636
* and(hasProperty(),eq())
3737

38+
* Naming
39+
- eq -> equals
40+
- lt -> less
41+
42+
* Selector/Refiner?

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import org.hamcrest.Matcher;
55
import org.hamcrest.Factory;
66
import org.hamcrest.TypeSafeMatcher;
7-
import static org.hamcrest.core.IsEqual.eq;
7+
import static org.hamcrest.core.IsEqual.equalTo;
88

99
import java.lang.reflect.Array;
1010

@@ -38,7 +38,7 @@ public static <T> Matcher<T[]> arrayContaining(Matcher<T> elementMatcher) {
3838

3939
@Factory
4040
public static <T> Matcher<T[]> arrayContaining(T element) {
41-
return arrayContaining(eq(element));
41+
return arrayContaining(equalTo(element));
4242
}
4343

4444
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import org.hamcrest.Matcher;
66
import org.hamcrest.Factory;
77
import org.hamcrest.TypeSafeMatcher;
8-
import static org.hamcrest.core.IsEqual.eq;
8+
import static org.hamcrest.core.IsEqual.equalTo;
99

1010
import java.util.Collection;
1111
import java.util.ArrayList;
@@ -38,7 +38,7 @@ public static <T> Matcher<Collection<T>> collectionContaining(Matcher<T> element
3838

3939
@Factory
4040
public static <T> Matcher<Collection<T>> collectionContaining(T element) {
41-
return collectionContaining(eq(element));
41+
return collectionContaining(equalTo(element));
4242
}
4343

4444
@Factory

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.hamcrest.TypeSafeMatcher;
77
import org.hamcrest.core.IsAnything;
88

9-
import static org.hamcrest.core.IsEqual.eq;
9+
import static org.hamcrest.core.IsEqual.equalTo;
1010

1111
import java.util.Map;
1212
import java.util.Map.Entry;
@@ -45,7 +45,7 @@ public static <K,V> Matcher<Map<K,V>> mapContaining(Matcher<K> keyMatcher, Match
4545

4646
@Factory
4747
public static <K,V> Matcher<Map<K,V>> mapContaining(K key, V value) {
48-
return mapContaining(eq(key), eq(value));
48+
return mapContaining(equalTo(key), equalTo(value));
4949
}
5050

5151
@Factory
@@ -55,7 +55,7 @@ public static <K,V> Matcher<Map<K,V>> mapWithKey(Matcher<K> keyMatcher) {
5555

5656
@Factory
5757
public static <K,V> Matcher<Map<K,V>> mapWithKey(K key) {
58-
return mapWithKey(eq(key));
58+
return mapWithKey(equalTo(key));
5959
}
6060

6161
@Factory
@@ -65,6 +65,6 @@ public static <K,V> Matcher<Map<K,V>> mapWithValue(Matcher<V> valueMatcher) {
6565

6666
@Factory
6767
public static <K,V> Matcher<Map<K,V>> mapWithValue(V value) {
68-
return mapWithValue(eq(value));
68+
return mapWithValue(equalTo(value));
6969
}
7070
}

‎src/library/org/hamcrest/core/IsEqual.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private static boolean isArray(Object o) {
6666
* {@link java.lang.Object#equals} invokedMethod?
6767
*/
6868
@Factory
69-
public static <T> Matcher<T> eq(T operand) {
69+
public static <T> Matcher<T> equalTo(T operand) {
7070
return new IsEqual<T>(operand);
7171
}
7272

@@ -75,15 +75,15 @@ public static <T> Matcher<T> eq(T operand) {
7575
*/
7676
@Factory
7777
public static Matcher<Boolean> isTrue() {
78-
return eq(true);
78+
return equalTo(true);
7979
}
8080

8181
/**
8282
* Is the value false?
8383
*/
8484
@Factory
8585
public static Matcher<Boolean> isFalse() {
86-
return eq(false);
86+
return equalTo(false);
8787
}
8888

8989
}

‎src/library/org/hamcrest/number/IsCloseTo.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ public void describeTo(Description description) {
3333
}
3434

3535
@Factory
36-
public static Matcher<Double> eq(double operand, double error) {
36+
public static Matcher<Double> closeTo(double operand, double error) {
3737
return new IsCloseTo(operand, error);
3838
}
3939

40-
4140
}

‎src/library/org/hamcrest/number/OrderingComparisons.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.hamcrest.number;
22

33
import static org.hamcrest.core.AnyOf.anyOf;
4-
import static org.hamcrest.core.IsEqual.eq;
4+
import static org.hamcrest.core.IsEqual.equalTo;
55
import static org.hamcrest.core.IsNot.not;
66
import static org.hamcrest.core.DescribedAs.describedAs;
77

@@ -18,7 +18,7 @@ public static <T extends Comparable<T>> Matcher<T> greaterThan(T value) {
1818
@Factory
1919
public static <T extends Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value) {
2020
return describedAs("a value greater than or equal to %0",
21-
anyOf(greaterThan(value), eq(value)),
21+
anyOf(greaterThan(value), equalTo(value)),
2222
value);
2323
}
2424

‎src/library/org/hamcrest/text/IsEqualIgnoringCase.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void describeTo(Description description) {
3535
}
3636

3737
@Factory
38-
public static Matcher<String> eqIgnoringCase(String string) {
38+
public static Matcher<String> equalToIgnoringCase(String string) {
3939
return new IsEqualIgnoringCase(string);
4040
}
4141

‎src/library/org/hamcrest/text/IsEqualIgnoringWhiteSpace.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public String stripSpace(String string) {
5353
}
5454

5555
@Factory
56-
public static Matcher<String> eqIgnoringWhiteSpace(String string) {
56+
public static Matcher<String> equalToIgnoringWhiteSpace(String string) {
5757
return new IsEqualIgnoringWhiteSpace(string);
5858
}
5959

‎src/unit-test/org/hamcrest/beans/HasPropertyWithValueTest.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import static org.hamcrest.MatcherAssert.assertThat;
66
import static org.hamcrest.beans.HasPropertyWithValue.hasProperty;
77
import static org.hamcrest.core.IsAnything.anything;
8-
import static org.hamcrest.core.IsEqual.eq;
8+
import static org.hamcrest.core.IsEqual.equalTo;
99
import static org.hamcrest.core.IsNot.not;
1010

1111
import java.beans.IntrospectionException;
@@ -34,12 +34,12 @@ protected Matcher<?> createMatcher() {
3434
}
3535

3636
public void testMatchesInfolessBeanWithMatchedNamedProperty() {
37-
assertThat(shouldMatch, hasProperty("property", eq("is expected")));
38-
assertThat(shouldNotMatch, not(hasProperty("property", eq("is expected"))));
37+
assertThat(shouldMatch, hasProperty("property", equalTo("is expected")));
38+
assertThat(shouldNotMatch, not(hasProperty("property", equalTo("is expected"))));
3939
}
4040

4141
public void testMatchesBeanWithInfoWithMatchedNamedProperty() {
42-
assertThat(beanWithInfo, hasProperty("property", eq("with info")));
42+
assertThat(beanWithInfo, hasProperty("property", equalTo("with info")));
4343
}
4444

4545
public void testDoesNotMatchInfolessBeanWithoutMatchedNamedProperty() {
@@ -51,7 +51,7 @@ public void testDoesNotMatchWriteOnlyProperty() {
5151
}
5252

5353
public void testDescribeTo() {
54-
Matcher matcher = eq(true);
54+
Matcher matcher = equalTo(true);
5555
Description isEqualDescription = new StringDescription();
5656
matcher.describeTo(isEqualDescription);
5757

0 commit comments

Comments
 (0)