Skip to content

Commit 54e0735

Browse files
author
joeretro
committed
Removed alwaysFails()/alwaysPasses() matchers.
1 parent cd4ef28 commit 54e0735

File tree

8 files changed

+14
-114
lines changed

8 files changed

+14
-114
lines changed

build.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
<mkdir dir="build/generated-code"/>
4646
<java classname="org.hamcrest.generator.config.XmlConfigurator"
4747
fork="yes"
48+
failonerror="yes"
4849
classpath="
4950
build/hamcrest-api-${version}.jar;
5051
build/hamcrest-generator-${version}.jar;

matchers.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
<factory class="org.hamcrest.core.IsNull"/>
1212
<factory class="org.hamcrest.core.IsIn"/>
1313
<factory class="org.hamcrest.core.IsInstanceOf"/>
14-
<factory class="org.hamcrest.core.Always"/>
1514
<factory class="org.hamcrest.core.DescribedAs"/>
1615

1716
<!-- Collection -->

src/library/org/hamcrest/core/Always.java

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/unit-test/org/hamcrest/AbstractMatcherTest.java

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

5-
import org.hamcrest.core.Always;
65
import junit.framework.TestCase;
76

87
public abstract class AbstractMatcherTest extends TestCase {
98

10-
protected static final Matcher<Boolean> TRUE_MATCHER = Always.alwaysPasses();
11-
protected static final Matcher<Boolean> FALSE_MATCHER = Always.alwaysFails();
12-
139
/**
1410
* Create an instance of the Matcher so some generic safety-net tests can be run on it.
1511
*/

src/unit-test/org/hamcrest/core/AlwaysTest.java

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/unit-test/org/hamcrest/core/DescribedAsTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@
22
*/
33
package org.hamcrest.core;
44

5-
import static org.hamcrest.core.Always.alwaysFails;
6-
import static org.hamcrest.core.Always.alwaysPasses;
5+
import static org.hamcrest.core.IsNot.not;
6+
import static org.hamcrest.core.IsAnything.anything;
77
import static org.hamcrest.core.DescribedAs.describedAs;
88
import org.hamcrest.AbstractMatcherTest;
99
import org.hamcrest.Matcher;
1010

1111
public class DescribedAsTest extends AbstractMatcherTest {
1212

1313
protected Matcher<?> createMatcher() {
14-
return describedAs("irrelevant", alwaysPasses());
14+
return describedAs("irrelevant", anything());
1515
}
1616

1717
public void testOverridesDescriptionOfOtherMatcherWithThatPassedToConstructor() {
18-
Matcher m1 = describedAs("m1 description", alwaysPasses());
19-
Matcher m2 = describedAs("m2 description", alwaysFails());
18+
Matcher m1 = describedAs("m1 description", anything());
19+
Matcher m2 = describedAs("m2 description", not(anything()));
2020

2121
assertDescription("m1 description", m1);
2222
assertDescription("m2 description", m2);
2323
}
2424

2525
public void testAppendsValuesToDescription() {
2626
Matcher m = describedAs("value 1 = %0, value 2 = %1",
27-
alwaysPasses(), 33, 97);
27+
anything(), 33, 97);
2828

2929
assertDescription("value 1 = <33>, value 2 = <97>", m);
3030
}
3131

3232
public void testDelegatesMatchingToAnotherMatcher() {
33-
Matcher<Object> m1 = describedAs("irrelevant", alwaysPasses());
34-
Matcher<Object> m2 = describedAs("irrelevant", alwaysFails());
33+
Matcher<Object> m1 = describedAs("irrelevant", anything());
34+
Matcher<Object> m2 = describedAs("irrelevant", not(anything()));
3535

3636
assertTrue(m1.matches(new Object()));
3737
assertFalse(m2.matches("hi"));

src/unit-test/org/hamcrest/core/IsNotTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22
*/
33
package org.hamcrest.core;
44

5+
import static org.hamcrest.core.IsEqual.equalTo;
56
import org.hamcrest.AbstractMatcherTest;
67
import org.hamcrest.Matcher;
78
import static org.hamcrest.core.IsNot.not;
89

910
public class IsNotTest extends AbstractMatcherTest {
1011

1112
protected Matcher<?> createMatcher() {
12-
return not(FALSE_MATCHER);
13+
return not("something");
1314
}
1415

1516
public void testEvaluatesToTheTheLogicalNegationOfAnotherMatcher() {
16-
assertFalse(not(TRUE_MATCHER).matches(ARGUMENT_IGNORED));
17-
assertTrue(not(FALSE_MATCHER).matches(ARGUMENT_IGNORED));
17+
assertMatches("should match", not(equalTo("A")), "B");
18+
assertDoesNotMatch("should not match", not(equalTo("B")), "B");
1819
}
1920

2021
public void testProvidesConvenientShortcutForNotEqualTo() {

src/unit-test/org/hamcrest/core/IsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public class IsTest extends AbstractMatcherTest {
99

1010
protected Matcher<?> createMatcher() {
11-
return is(FALSE_MATCHER);
11+
return is("something");
1212
}
1313

1414
public void testJustMatchesTheSameWayTheUnderylingMatcherDoes() {

0 commit comments

Comments
 (0)