aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Eluard <[email protected]>2014-10-02 21:51:24 -0300
committerJulien Eluard <[email protected]>2014-10-02 21:51:24 -0300
commit8c7074acc888f221279ec05a6275038b449829fe (patch)
tree93e8d19ac34005d2404b92571ad77f9be12a13da
parent12649993a2638e8998ed848f6845fd2e0208b773 (diff)
parentd56837d8c421a977bf2fb79f6f6ace664dd52890 (diff)
Merge pull request #47 from syev/master
Fix #46: Fix return values from include filters
-rwxr-xr-xapi/src/main/java/org/semver/jardiff/DifferenceAccumulatingHandler.java3
-rw-r--r--api/src/test/java/org/semver/jardiff/DifferenceAccumulatingHandlerTest.java26
2 files changed, 28 insertions, 1 deletions
diff --git a/api/src/main/java/org/semver/jardiff/DifferenceAccumulatingHandler.java b/api/src/main/java/org/semver/jardiff/DifferenceAccumulatingHandler.java
index d7d97e1..a2b8ae9 100755
--- a/api/src/main/java/org/semver/jardiff/DifferenceAccumulatingHandler.java
+++ b/api/src/main/java/org/semver/jardiff/DifferenceAccumulatingHandler.java
@@ -286,9 +286,10 @@ public final class DifferenceAccumulatingHandler extends AbstractDiffHandler {
final Matcher includeMatcher = includePattern.matcher( fixedClassName );
while ( includeMatcher.find() ) {
- return false;
+ return true;
}
}
+ return false;
}
return true;
}
diff --git a/api/src/test/java/org/semver/jardiff/DifferenceAccumulatingHandlerTest.java b/api/src/test/java/org/semver/jardiff/DifferenceAccumulatingHandlerTest.java
index 9215a77..0facba8 100644
--- a/api/src/test/java/org/semver/jardiff/DifferenceAccumulatingHandlerTest.java
+++ b/api/src/test/java/org/semver/jardiff/DifferenceAccumulatingHandlerTest.java
@@ -300,4 +300,30 @@ public class DifferenceAccumulatingHandlerTest {
Assert.assertEquals( "Class should not be considered: ", false, new DifferenceAccumulatingHandler(
inclusionSet, exclusionSet ).isClassConsidered( "de/test/java/regex/Impl" ) );
}
+
+ @Test
+ public void shouldClassNotBeConsideredWhenNotMatchingAnyDefinedInclude() {
+
+ List<String> inclusions = new ArrayList<String>();
+ inclusions.add( "test/java/regex/code/*" );
+ Set<String> inclusionSet = new HashSet<String>( inclusions );
+ List<String> exclusions = new ArrayList<String>();
+ Set<String> exclusionSet = new HashSet<String>( exclusions );
+
+ Assert.assertEquals( "Class should not be considered: ", false, new DifferenceAccumulatingHandler(
+ inclusionSet, exclusionSet ).isClassConsidered( "de/test/java/regex/Impl" ) );
+ }
+
+ @Test
+ public void shouldClassBeConsideredWhenMatchingDefinedInclude() {
+
+ List<String> inclusions = new ArrayList<String>();
+ inclusions.add( "test/java/regex/code/*" );
+ Set<String> inclusionSet = new HashSet<String>( inclusions );
+ List<String> exclusions = new ArrayList<String>();
+ Set<String> exclusionSet = new HashSet<String>( exclusions );
+
+ Assert.assertEquals( "Class should be considered: ", true, new DifferenceAccumulatingHandler(
+ inclusionSet, exclusionSet ).isClassConsidered( "de/test/java/regex/code/Impl" ) );
+ }
}