Skip to content

Commit dd770f8

Browse files
author
joeretro
committed
Added AllOf, AnyOf etc.
1 parent 97b3a06 commit dd770f8

6 files changed

Lines changed: 60 additions & 180 deletions

File tree

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

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

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

Lines changed: 0 additions & 57 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package org.hamcrest.core;
2+
3+
import static org.hamcrest.MatcherAssert.assertThat;
4+
import static org.hamcrest.core.IsNot.not;
5+
import static org.hamcrest.core.IsEqual.eq;
6+
import static org.hamcrest.core.AllOf.allOf;
7+
import org.hamcrest.AbstractMatcherTest;
8+
import org.hamcrest.Matcher;
9+
10+
@SuppressWarnings("unchecked")
11+
public class AllOfTest extends AbstractMatcherTest {
12+
13+
protected Matcher<?> createMatcher() {
14+
return allOf(eq("irrelevant"), eq("irrelevant"));
15+
}
16+
17+
public void testEvaluatesToTheTheLogicalConjunctionOfTwoOtherMatchers() {
18+
assertThat("good", allOf(eq("good"), eq("good")));
19+
20+
assertThat("good", not(allOf(eq("bad"), eq("good"))));
21+
assertThat("good", not(allOf(eq("good"), eq("bad"))));
22+
assertThat("good", not(allOf(eq("bad"), eq("bad"))));
23+
}
24+
25+
public void testEvaluatesToTheTheLogicalConjunctionOfManyOtherMatchers() {
26+
assertThat("good", allOf(eq("good"), eq("good"), eq("good"), eq("good"), eq("good")));
27+
assertThat("good", not(allOf(eq("good"), eq("good"), eq("bad"), eq("good"), eq("good"))));
28+
}
29+
30+
}

‎src/unit-test/org/hamcrest/core/AndTest.java‎

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package org.hamcrest.core;
2+
3+
import org.hamcrest.AbstractMatcherTest;
4+
import org.hamcrest.Matcher;
5+
import static org.hamcrest.MatcherAssert.assertThat;
6+
import static org.hamcrest.core.AnyOf.anyOf;
7+
import static org.hamcrest.core.IsEqual.eq;
8+
import static org.hamcrest.core.IsNot.not;
9+
10+
@SuppressWarnings("unchecked")
11+
public class AnyOfTest extends AbstractMatcherTest {
12+
13+
protected Matcher<?> createMatcher() {
14+
return anyOf(eq("irrelevant"));
15+
}
16+
17+
public void testEvaluatesToTheTheLogicalDisjunctionOfTwoOtherMatchers() {
18+
assertThat("good", anyOf(eq("bad"), eq("good")));
19+
assertThat("good", anyOf(eq("good"), eq("good")));
20+
assertThat("good", anyOf(eq("good"), eq("bad")));
21+
22+
assertThat("good", not(anyOf(eq("bad"), eq("bad"))));
23+
}
24+
25+
public void testEvaluatesToTheTheLogicalDisjunctionOfManyOtherMatchers() {
26+
assertThat("good", anyOf(eq("bad"), eq("good"), eq("bad"), eq("bad"), eq("bad")));
27+
assertThat("good", not(anyOf(eq("bad"), eq("bad"), eq("bad"), eq("bad"), eq("bad"))));
28+
}
29+
30+
}

‎src/unit-test/org/hamcrest/core/OrTest.java‎

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

0 commit comments

Comments
 (0)