aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core.test
diff options
context:
space:
mode:
authorJeff Gaston <jeffrygaston@google.com>2017-06-27 17:59:01 +0000
committerJeff Gaston <jeffrygaston@google.com>2017-06-27 17:59:01 +0000
commit10750c3a7c7525f405b028832e0a521293f799ca (patch)
treec2efd9dea10bbe33e14818d9c6f9f52a17baf24e /org.jacoco.core.test
parentbbe2e9a9b2c9f829bc5e906c218244205c5bfbab (diff)
downloadjacoco-10750c3a7c7525f405b028832e0a521293f799ca.tar.gz
Revert "Add ClassnameMatcher in preparation to pass into Instrumenter for filtering"
This reverts commit bbe2e9a9b2c9f829bc5e906c218244205c5bfbab. Reason for revert: moving filtering out of Jacoco and into Make Change-Id: I58b9c4eb1fc6d6984cf7cb4b9dd74bdbcf4f8956
Diffstat (limited to 'org.jacoco.core.test')
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/matcher/IncludeExcludeMatcherTest.java75
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/matcher/WildcardMatcherTest.java44
2 files changed, 22 insertions, 97 deletions
diff --git a/org.jacoco.core.test/src/org/jacoco/core/matcher/IncludeExcludeMatcherTest.java b/org.jacoco.core.test/src/org/jacoco/core/matcher/IncludeExcludeMatcherTest.java
deleted file mode 100644
index e0268956..00000000
--- a/org.jacoco.core.test/src/org/jacoco/core/matcher/IncludeExcludeMatcherTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2017 Mountainminds GmbH & Co. KG and Contributors
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Jeffry Gaston - initial API and implementation
- *
- *******************************************************************************/
-package org.jacoco.core.matcher;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-public class IncludeExcludeMatcherTest {
-
- @Test
- public void testEmpty() {
- assertTrue(new IncludeExcludeMatcher<String>().apply("includeMe"));
- }
-
- @Test
- public void testSingleExclude() {
- IncludeExcludeMatcher<String> matcher = new IncludeExcludeMatcher<String>()
- .exclude(new WildcardMatcher("excluded"));
- assertTrue(matcher.apply("included"));
- assertFalse(matcher.apply("excluded"));
- }
-
- @Test
- public void testMultipleExcludes() {
- IncludeExcludeMatcher<String> matcher = new IncludeExcludeMatcher<String>().exclude(
- new WildcardMatcher("excluded"))
- .exclude(new WildcardMatcher("excluded2"));
- assertTrue(matcher.apply("included"));
- assertFalse(matcher.apply("excluded"));
- assertFalse(matcher.apply("excluded2"));
- }
-
- @Test
- public void testSingleInclude() {
- IncludeExcludeMatcher<String> matcher = new IncludeExcludeMatcher<String>()
- .include(new WildcardMatcher("include me"));
- assertTrue(matcher.apply("include me"));
- assertFalse(matcher.apply("not me"));
- }
-
- @Test
- public void testIncludesAndExcludes() {
- IncludeExcludeMatcher<String> matcher = new IncludeExcludeMatcher<String>()
- .include(new WildcardMatcher("inclusion1"))
- .include(new WildcardMatcher("me too"))
- .exclude(new WildcardMatcher("not me"))
- .exclude(new WildcardMatcher("nope"));
- assertTrue(matcher.apply("inclusion1"));
- assertTrue(matcher.apply("me too"));
- assertFalse(matcher.apply("not me"));
- assertFalse(matcher.apply("nope"));
- assertFalse(matcher.apply("other"));
- }
-
- @Test
- public void testExcludedInclusion() {
- IncludeExcludeMatcher<String> matcher = new IncludeExcludeMatcher<String>()
- .include(new WildcardMatcher("a"))
- .exclude(new WildcardMatcher("a"));
- assertFalse(matcher.apply("a"));
- assertFalse(matcher.apply("b"));
- }
-
-}
diff --git a/org.jacoco.core.test/src/org/jacoco/core/matcher/WildcardMatcherTest.java b/org.jacoco.core.test/src/org/jacoco/core/matcher/WildcardMatcherTest.java
index baf1dc2b..0d0a9c0a 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/matcher/WildcardMatcherTest.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/matcher/WildcardMatcherTest.java
@@ -20,53 +20,53 @@ public class WildcardMatcherTest {
@Test
public void testEmpty() {
- assertTrue(new WildcardMatcher("").apply(""));
- assertFalse(new WildcardMatcher("").apply("abc"));
+ assertTrue(new WildcardMatcher("").matches(""));
+ assertFalse(new WildcardMatcher("").matches("abc"));
}
@Test
public void testExact() {
- assertTrue(new WildcardMatcher("abc/def.txt").apply("abc/def.txt"));
+ assertTrue(new WildcardMatcher("abc/def.txt").matches("abc/def.txt"));
}
@Test
public void testCaseSensitive() {
- assertFalse(new WildcardMatcher("abcdef").apply("abcDef"));
- assertFalse(new WildcardMatcher("ABCDEF").apply("AbCDEF"));
+ assertFalse(new WildcardMatcher("abcdef").matches("abcDef"));
+ assertFalse(new WildcardMatcher("ABCDEF").matches("AbCDEF"));
}
@Test
public void testQuote() {
- assertFalse(new WildcardMatcher("rst.xyz").apply("rstAxyz"));
- assertTrue(new WildcardMatcher("(x)+").apply("(x)+"));
+ assertFalse(new WildcardMatcher("rst.xyz").matches("rstAxyz"));
+ assertTrue(new WildcardMatcher("(x)+").matches("(x)+"));
}
@Test
public void testWildcards() {
- assertTrue(new WildcardMatcher("*").apply(""));
- assertTrue(new WildcardMatcher("*").apply("java/lang/Object"));
- assertTrue(new WildcardMatcher("*Test").apply("jacoco/MatcherTest"));
- assertTrue(new WildcardMatcher("Matcher*").apply("Matcher"));
- assertTrue(new WildcardMatcher("Matcher*").apply("MatcherTest"));
- assertTrue(new WildcardMatcher("a*b*a").apply("a-b-b-a"));
- assertFalse(new WildcardMatcher("a*b*a").apply("alaska"));
- assertTrue(new WildcardMatcher("Hello?orld").apply("HelloWorld"));
- assertFalse(new WildcardMatcher("Hello?orld").apply("HelloWWWorld"));
- assertTrue(new WildcardMatcher("?aco*").apply("jacoco"));
+ assertTrue(new WildcardMatcher("*").matches(""));
+ assertTrue(new WildcardMatcher("*").matches("java/lang/Object"));
+ assertTrue(new WildcardMatcher("*Test").matches("jacoco/MatcherTest"));
+ assertTrue(new WildcardMatcher("Matcher*").matches("Matcher"));
+ assertTrue(new WildcardMatcher("Matcher*").matches("MatcherTest"));
+ assertTrue(new WildcardMatcher("a*b*a").matches("a-b-b-a"));
+ assertFalse(new WildcardMatcher("a*b*a").matches("alaska"));
+ assertTrue(new WildcardMatcher("Hello?orld").matches("HelloWorld"));
+ assertFalse(new WildcardMatcher("Hello?orld").matches("HelloWWWorld"));
+ assertTrue(new WildcardMatcher("?aco*").matches("jacoco"));
}
@Test
public void testMultiExpression() {
- assertTrue(new WildcardMatcher("Hello:World").apply("World"));
- assertTrue(new WildcardMatcher("Hello:World").apply("World"));
- assertTrue(new WildcardMatcher("*Test:*Foo").apply("UnitTest"));
+ assertTrue(new WildcardMatcher("Hello:World").matches("World"));
+ assertTrue(new WildcardMatcher("Hello:World").matches("World"));
+ assertTrue(new WildcardMatcher("*Test:*Foo").matches("UnitTest"));
}
@Test
public void testDollar() {
- assertTrue(new WildcardMatcher("*$*").apply("java/util/Map$Entry"));
+ assertTrue(new WildcardMatcher("*$*").matches("java/util/Map$Entry"));
assertTrue(new WildcardMatcher("*$$$*")
- .apply("org/example/Enity$$$generated123"));
+ .matches("org/example/Enity$$$generated123"));
}
}