Skip to content

Commit 4ef2fa6

Browse files
author
joeretro
committed
Trashed a load more methods in the Matchers uberclass (soon to be replaced).
1 parent b3bd78a commit 4ef2fa6

7 files changed

Lines changed: 16 additions & 37 deletions

File tree

‎src/examples/org/hamcrest/examples/junit3/ExampleWithAssertThat.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import junit.framework.TestCase;
44
import static org.hamcrest.MatcherAssert.assertThat;
5-
import static org.hamcrest.Matchers.*;
5+
import static org.hamcrest.Matchers.isTwoXs;
6+
import static org.hamcrest.core.IsNot.not;
67
import static org.hamcrest.text.StringContains.stringContains;
78

89
/**

‎src/examples/org/hamcrest/examples/junit4/ExampleWithAssertThat.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import static org.hamcrest.MatcherAssert.assertThat;
44
import static org.hamcrest.Matchers.isTwoXs;
5-
import static org.hamcrest.Matchers.not;
5+
import static org.hamcrest.core.IsNot.not;
66
import static org.hamcrest.text.StringContains.stringContains;
77
import org.junit.Test;
88

‎src/examples/org/hamcrest/examples/testng/ExampleWithAssertThat.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import static org.hamcrest.MatcherAssert.assertThat;
44
import static org.hamcrest.Matchers.isTwoXs;
5-
import static org.hamcrest.Matchers.not;
5+
import static org.hamcrest.core.IsNot.not;
66
import static org.hamcrest.text.StringContains.stringContains;
77
import org.testng.annotations.Test;
88

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

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22
*/
33
package org.hamcrest;
44

5-
import org.hamcrest.core.And;
65
import org.hamcrest.core.IsAnything;
76
import org.hamcrest.core.IsCompatibleType;
8-
import org.hamcrest.core.IsEqual;
97
import org.hamcrest.core.IsIn;
108
import org.hamcrest.core.IsInstanceOf;
119
import org.hamcrest.core.IsNot;
1210
import org.hamcrest.core.IsNull;
13-
import org.hamcrest.core.Or;
14-
import org.hamcrest.internal.StringDescription;
1511

1612
import java.util.Collection;
1713

@@ -20,39 +16,11 @@ public class Matchers {
2016
public static final Matcher ANYTHING = new IsAnything();
2117
public static final Matcher NULL = new IsNull();
2218
public static final Matcher NOT_NULL = new IsNot(NULL);
23-
public static final Matcher IS_TRUE = new IsEqual(Boolean.TRUE);
24-
public static final Matcher IS_FALSE = new IsEqual(Boolean.FALSE);
25-
26-
public static <T> void assertThat(T value, Matcher<T> isMatchedBy) {
27-
if (!isMatchedBy.match(value)) {
28-
Description description = new StringDescription();
29-
description.appendText("\nExpected: ");
30-
isMatchedBy.describeTo(description);
31-
description.appendText("\n got : ").appendValue(value).appendText("\n");
32-
throw new AssertionError(description.toString());
33-
}
34-
}
35-
36-
public static IsEqual eq(Object operand) {
37-
return new IsEqual(operand);
38-
}
3919

4020
public static IsInstanceOf isA(Class operandClass) {
4121
return new IsInstanceOf(operandClass);
4222
}
4323

44-
public static <T> Matcher<T> not(Matcher<T> c) {
45-
return new IsNot<T>(c);
46-
}
47-
48-
public static <T> Matcher<T> and(Matcher<T> left, Matcher<T> right) {
49-
return new And<T>(left, right);
50-
}
51-
52-
public static <T> Matcher<T> or(Matcher<T> left, Matcher<T> right) {
53-
return new Or<T>(left, right);
54-
}
55-
5624
public static IsCompatibleType compatibleType(Class baseType) {
5725
return new IsCompatibleType(baseType);
5826
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,14 @@ public static <T> Matcher<T> eq(T operand) {
6565
return new IsEqual<T>(operand);
6666
}
6767

68+
@Factory
69+
public static Matcher<Boolean> isTrue() {
70+
return eq(true);
71+
}
72+
73+
@Factory
74+
public static Matcher<Boolean> isFalse() {
75+
return eq(false);
76+
}
77+
6878
}

‎src/unit-test/org/hamcrest/integration/EasyMockAdapterTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.hamcrest.integration;
22

33
import junit.framework.TestCase;
4-
import static org.hamcrest.Matchers.*;
4+
import static org.hamcrest.core.IsEqual.eq;
55
import org.hamcrest.Matcher;
66
import org.hamcrest.Description;
77
import org.easymock.IArgumentMatcher;

‎src/unit-test/org/hamcrest/integration/JMockAdapterTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.hamcrest.integration;
22

33
import junit.framework.TestCase;
4-
import static org.hamcrest.Matchers.*;
4+
import static org.hamcrest.core.IsEqual.eq;
55
import org.hamcrest.Matcher;
66
import org.hamcrest.Description;
77
import org.jmock.core.Constraint;

0 commit comments

Comments
 (0)