@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" ) ); }
protected boolean isClassConsidered( final String className ) { final String fixedClassName = className.replace('.', '/'); for ( String exclude : this.excludes ) { final Pattern excludePattern; if( !excludesAreRegExp ) { if ( exclude.contains( "" ) ) { exclude = exclude.replaceAll( "/\\*\\*/", "{0,1}**/" ); } if ( exclude.contains( "", "{0,1}*/{0,1}" ); } excludePattern = simplifyRegularExpression( exclude, false ); } else { excludePattern = Pattern.compile( exclude ); } final Matcher excludeMatcher = excludePattern.matcher( fixedClassName ); while ( excludeMatcher.find() ) { return false; } } if ( !this.includes.isEmpty() ) { for ( String include : this.includes ) { final Pattern includePattern; if( !includesAreRegExp ) { if ( include.contains( "" ) ) { include = include.replaceAll( "/\\*\\*/", "{0,1}**/" ); } if ( include.contains( "", "{0,1}*/{0,1}" ); } includePattern = simplifyRegularExpression( include, false ); } else { includePattern = Pattern.compile( include ); } final Matcher includeMatcher = includePattern.matcher( fixedClassName ); while ( includeMatcher.find() ) { return true; } } return false; } return true; }
DifferenceAccumulatingHandler extends AbstractDiffHandler { protected boolean isClassConsidered( final String className ) { final String fixedClassName = className.replace('.', '/'); for ( String exclude : this.excludes ) { final Pattern excludePattern; if( !excludesAreRegExp ) { if ( exclude.contains( "" ) ) { exclude = exclude.replaceAll( "/\\*\\*/", "{0,1}**/" ); } if ( exclude.contains( "", "{0,1}*/{0,1}" ); } excludePattern = simplifyRegularExpression( exclude, false ); } else { excludePattern = Pattern.compile( exclude ); } final Matcher excludeMatcher = excludePattern.matcher( fixedClassName ); while ( excludeMatcher.find() ) { return false; } } if ( !this.includes.isEmpty() ) { for ( String include : this.includes ) { final Pattern includePattern; if( !includesAreRegExp ) { if ( include.contains( "" ) ) { include = include.replaceAll( "/\\*\\*/", "{0,1}**/" ); } if ( include.contains( "", "{0,1}*/{0,1}" ); } includePattern = simplifyRegularExpression( include, false ); } else { includePattern = Pattern.compile( include ); } final Matcher includeMatcher = includePattern.matcher( fixedClassName ); while ( includeMatcher.find() ) { return true; } } return false; } return true; } }
DifferenceAccumulatingHandler extends AbstractDiffHandler { protected boolean isClassConsidered( final String className ) { final String fixedClassName = className.replace('.', '/'); for ( String exclude : this.excludes ) { final Pattern excludePattern; if( !excludesAreRegExp ) { if ( exclude.contains( "" ) ) { exclude = exclude.replaceAll( "/\\*\\*/", "{0,1}**/" ); } if ( exclude.contains( "", "{0,1}*/{0,1}" ); } excludePattern = simplifyRegularExpression( exclude, false ); } else { excludePattern = Pattern.compile( exclude ); } final Matcher excludeMatcher = excludePattern.matcher( fixedClassName ); while ( excludeMatcher.find() ) { return false; } } if ( !this.includes.isEmpty() ) { for ( String include : this.includes ) { final Pattern includePattern; if( !includesAreRegExp ) { if ( include.contains( "" ) ) { include = include.replaceAll( "/\\*\\*/", "{0,1}**/" ); } if ( include.contains( "", "{0,1}*/{0,1}" ); } includePattern = simplifyRegularExpression( include, false ); } else { includePattern = Pattern.compile( include ); } final Matcher includeMatcher = includePattern.matcher( fixedClassName ); while ( includeMatcher.find() ) { return true; } } return false; } return true; } DifferenceAccumulatingHandler();  DifferenceAccumulatingHandler(@Nonnull final Set<String> includes, @Nonnull final Set<String> excludes);  DifferenceAccumulatingHandler(@Nonnull final Set<String> includes, final boolean includesAreRegExp,
                                         @Nonnull final Set<String> excludes, final boolean excludesAreRegExp); }
DifferenceAccumulatingHandler extends AbstractDiffHandler { protected boolean isClassConsidered( final String className ) { final String fixedClassName = className.replace('.', '/'); for ( String exclude : this.excludes ) { final Pattern excludePattern; if( !excludesAreRegExp ) { if ( exclude.contains( "" ) ) { exclude = exclude.replaceAll( "/\\*\\*/", "{0,1}**/" ); } if ( exclude.contains( "", "{0,1}*/{0,1}" ); } excludePattern = simplifyRegularExpression( exclude, false ); } else { excludePattern = Pattern.compile( exclude ); } final Matcher excludeMatcher = excludePattern.matcher( fixedClassName ); while ( excludeMatcher.find() ) { return false; } } if ( !this.includes.isEmpty() ) { for ( String include : this.includes ) { final Pattern includePattern; if( !includesAreRegExp ) { if ( include.contains( "" ) ) { include = include.replaceAll( "/\\*\\*/", "{0,1}**/" ); } if ( include.contains( "", "{0,1}*/{0,1}" ); } includePattern = simplifyRegularExpression( include, false ); } else { includePattern = Pattern.compile( include ); } final Matcher includeMatcher = includePattern.matcher( fixedClassName ); while ( includeMatcher.find() ) { return true; } } return false; } return true; } DifferenceAccumulatingHandler();  DifferenceAccumulatingHandler(@Nonnull final Set<String> includes, @Nonnull final Set<String> excludes);  DifferenceAccumulatingHandler(@Nonnull final Set<String> includes, final boolean includesAreRegExp,
                                         @Nonnull final Set<String> excludes, final boolean excludesAreRegExp); String getCurrentClassName(); @Override void startDiff(final String previous, final String current); @Override void endDiff(); @Override void startOldContents(); @Override void endOldContents(); @Override void startNewContents(); @Override void endNewContents(); @Override void contains(final ClassInfo classInfo); @Override void startAdded(); @Override void classAdded(final ClassInfo classInfo); @Override void fieldAdded(final FieldInfo fieldInfo); @Override void methodAdded(final MethodInfo methodInfo); @Override void endAdded(); @Override void startChanged(); @Override void startClassChanged(final String className); @Override void classChanged(final ClassInfo oldClassInfo, final ClassInfo newClassInfo); @Override void classDeprecated(final ClassInfo oldClassInfo, final ClassInfo newClassInfo); @Override void fieldChanged(final FieldInfo oldFieldInfo, final FieldInfo newFieldInfo); @Override void fieldDeprecated(final FieldInfo oldFieldInfo, final FieldInfo newFieldInfo); @Override void methodChanged(final MethodInfo oldMethodInfo, final MethodInfo newMethodInfo); @Override void methodDeprecated(final MethodInfo oldMethodInfo, final MethodInfo newMethodInfo); @Override void endClassChanged(); @Override void endChanged(); @Override void startRemoved(); @Override void classRemoved(final ClassInfo classInfo); @Override void fieldRemoved(final FieldInfo fieldInfo); @Override void methodRemoved(final MethodInfo methodInfo); @Override void endRemoved(); Delta getDelta(); }
DifferenceAccumulatingHandler extends AbstractDiffHandler { protected boolean isClassConsidered( final String className ) { final String fixedClassName = className.replace('.', '/'); for ( String exclude : this.excludes ) { final Pattern excludePattern; if( !excludesAreRegExp ) { if ( exclude.contains( "" ) ) { exclude = exclude.replaceAll( "/\\*\\*/", "{0,1}**/" ); } if ( exclude.contains( "", "{0,1}*/{0,1}" ); } excludePattern = simplifyRegularExpression( exclude, false ); } else { excludePattern = Pattern.compile( exclude ); } final Matcher excludeMatcher = excludePattern.matcher( fixedClassName ); while ( excludeMatcher.find() ) { return false; } } if ( !this.includes.isEmpty() ) { for ( String include : this.includes ) { final Pattern includePattern; if( !includesAreRegExp ) { if ( include.contains( "" ) ) { include = include.replaceAll( "/\\*\\*/", "{0,1}**/" ); } if ( include.contains( "", "{0,1}*/{0,1}" ); } includePattern = simplifyRegularExpression( include, false ); } else { includePattern = Pattern.compile( include ); } final Matcher includeMatcher = includePattern.matcher( fixedClassName ); while ( includeMatcher.find() ) { return true; } } return false; } return true; } DifferenceAccumulatingHandler();  DifferenceAccumulatingHandler(@Nonnull final Set<String> includes, @Nonnull final Set<String> excludes);  DifferenceAccumulatingHandler(@Nonnull final Set<String> includes, final boolean includesAreRegExp,
                                         @Nonnull final Set<String> excludes, final boolean excludesAreRegExp); String getCurrentClassName(); @Override void startDiff(final String previous, final String current); @Override void endDiff(); @Override void startOldContents(); @Override void endOldContents(); @Override void startNewContents(); @Override void endNewContents(); @Override void contains(final ClassInfo classInfo); @Override void startAdded(); @Override void classAdded(final ClassInfo classInfo); @Override void fieldAdded(final FieldInfo fieldInfo); @Override void methodAdded(final MethodInfo methodInfo); @Override void endAdded(); @Override void startChanged(); @Override void startClassChanged(final String className); @Override void classChanged(final ClassInfo oldClassInfo, final ClassInfo newClassInfo); @Override void classDeprecated(final ClassInfo oldClassInfo, final ClassInfo newClassInfo); @Override void fieldChanged(final FieldInfo oldFieldInfo, final FieldInfo newFieldInfo); @Override void fieldDeprecated(final FieldInfo oldFieldInfo, final FieldInfo newFieldInfo); @Override void methodChanged(final MethodInfo oldMethodInfo, final MethodInfo newMethodInfo); @Override void methodDeprecated(final MethodInfo oldMethodInfo, final MethodInfo newMethodInfo); @Override void endClassChanged(); @Override void endChanged(); @Override void startRemoved(); @Override void classRemoved(final ClassInfo classInfo); @Override void fieldRemoved(final FieldInfo fieldInfo); @Override void methodRemoved(final MethodInfo methodInfo); @Override void endRemoved(); Delta getDelta();  }