@Test public void testRegexNoMatchAbsolutePath() { matchAbsolutePath = true; regexFileFilter = new RegexFileFilter(regex, matchAbsolutePath); when(file.getAbsolutePath()).thenReturn("/abs/path/to/testMe.java"); assertFalse(regexFileFilter.accept(file)); }
@Override public boolean accept(File pathname) { String pathToMatch = matchAbsolutePath ? pathname.getAbsolutePath() : pathname.getName(); return pattern.matcher(pathToMatch).matches(); }
RegexFileFilter implements ParcelableFileFilter { @Override public boolean accept(File pathname) { String pathToMatch = matchAbsolutePath ? pathname.getAbsolutePath() : pathname.getName(); return pattern.matcher(pathToMatch).matches(); } }
RegexFileFilter implements ParcelableFileFilter { @Override public boolean accept(File pathname) { String pathToMatch = matchAbsolutePath ? pathname.getAbsolutePath() : pathname.getName(); return pattern.matcher(pathToMatch).matches(); } RegexFileFilter(String regex, boolean matchAbsolutePath); }
RegexFileFilter implements ParcelableFileFilter { @Override public boolean accept(File pathname) { String pathToMatch = matchAbsolutePath ? pathname.getAbsolutePath() : pathname.getName(); return pattern.matcher(pathToMatch).matches(); } RegexFileFilter(String regex, boolean matchAbsolutePath); @Override boolean accept(File pathname); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); }
RegexFileFilter implements ParcelableFileFilter { @Override public boolean accept(File pathname) { String pathToMatch = matchAbsolutePath ? pathname.getAbsolutePath() : pathname.getName(); return pattern.matcher(pathToMatch).matches(); } RegexFileFilter(String regex, boolean matchAbsolutePath); @Override boolean accept(File pathname); @Override int describeContents(); @Override void writeToParcel(Parcel dest, int flags); static final Creator<RegexFileFilter> CREATOR; }