summaryrefslogtreecommitdiffstats
path: root/junit4/src/test/java/org/junit/tests/manipulation/FilterTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'junit4/src/test/java/org/junit/tests/manipulation/FilterTest.java')
-rw-r--r--junit4/src/test/java/org/junit/tests/manipulation/FilterTest.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/junit4/src/test/java/org/junit/tests/manipulation/FilterTest.java b/junit4/src/test/java/org/junit/tests/manipulation/FilterTest.java
new file mode 100644
index 0000000..242e990
--- /dev/null
+++ b/junit4/src/test/java/org/junit/tests/manipulation/FilterTest.java
@@ -0,0 +1,49 @@
+package org.junit.tests.manipulation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+import org.junit.Test;
+import org.junit.runner.Description;
+import org.junit.runner.manipulation.Filter;
+
+public class FilterTest {
+ public static class NamedFilter extends Filter {
+ private final String fName;
+
+ public NamedFilter(String name) {
+ fName= name;
+ }
+
+ @Override
+ public boolean shouldRun(Description description) {
+ return false;
+ }
+
+ @Override
+ public String describe() {
+ return fName;
+ }
+ }
+
+ @Test
+ public void intersectionText() {
+ NamedFilter a= new NamedFilter("a");
+ NamedFilter b= new NamedFilter("b");
+ assertEquals("a and b", a.intersect(b).describe());
+ assertEquals("b and a", b.intersect(a).describe());
+ }
+
+ @Test
+ public void intersectSelf() {
+ NamedFilter a= new NamedFilter("a");
+ assertSame(a, a.intersect(a));
+ }
+
+ @Test
+ public void intersectAll() {
+ NamedFilter a= new NamedFilter("a");
+ assertSame(a, a.intersect(Filter.ALL));
+ assertSame(a, Filter.ALL.intersect(a));
+ assertSame(Filter.ALL, Filter.ALL.intersect(Filter.ALL));
+ }
+}