From d56837d8c421a977bf2fb79f6f6ace664dd52890 Mon Sep 17 00:00:00 2001 From: syev Date: Thu, 2 Oct 2014 17:39:10 +0200 Subject: Added inclusion filter matching tests Non regression tests for https://github.com/jeluard/semantic-versioning/issues/46 --- .../jardiff/DifferenceAccumulatingHandlerTest.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'api') 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 inclusions = new ArrayList(); + inclusions.add( "test/java/regex/code/*" ); + Set inclusionSet = new HashSet( inclusions ); + List exclusions = new ArrayList(); + Set exclusionSet = new HashSet( exclusions ); + + Assert.assertEquals( "Class should not be considered: ", false, new DifferenceAccumulatingHandler( + inclusionSet, exclusionSet ).isClassConsidered( "de/test/java/regex/Impl" ) ); + } + + @Test + public void shouldClassBeConsideredWhenMatchingDefinedInclude() { + + List inclusions = new ArrayList(); + inclusions.add( "test/java/regex/code/*" ); + Set inclusionSet = new HashSet( inclusions ); + List exclusions = new ArrayList(); + Set exclusionSet = new HashSet( exclusions ); + + Assert.assertEquals( "Class should be considered: ", true, new DifferenceAccumulatingHandler( + inclusionSet, exclusionSet ).isClassConsidered( "de/test/java/regex/code/Impl" ) ); + } } -- cgit v1.2.3