@@ -42,20 +42,16 @@ public class RegexFileFilterTest {
4242
4343 public void assertFiltering (final IOFileFilter filter , final File file , final boolean expected ) {
4444 // Note. This only tests the (File, String) version if the parent of
45- // the File passed in is not null
46- assertEquals (expected , filter .accept (file ),
47- "Filter(File) " + filter .getClass ().getName () + " not " + expected + " for " + file );
45+ // the File passed in is not null
46+ assertEquals (expected , filter .accept (file ), "Filter(File) " + filter .getClass ().getName () + " not " + expected + " for " + file );
4847
4948 if (file != null && file .getParentFile () != null ) {
5049 assertEquals (expected , filter .accept (file .getParentFile (), file .getName ()),
5150 "Filter(File, String) " + filter .getClass ().getName () + " not " + expected + " for " + file );
52- assertEquals (expected , filter .matches (file .toPath ()),
53- "Filter(File, String) " + filter .getClass ().getName () + " not " + expected + " for " + file );
51+ assertEquals (expected , filter .matches (file .toPath ()), "Filter(File, String) " + filter .getClass ().getName () + " not " + expected + " for " + file );
5452 } else if (file == null ) {
55- assertEquals (expected , filter .accept (file ),
56- "Filter(File, String) " + filter .getClass ().getName () + " not " + expected + " for null" );
57- assertEquals (expected , filter .matches (null ),
58- "Filter(File, String) " + filter .getClass ().getName () + " not " + expected + " for null" );
53+ assertEquals (expected , filter .accept (file ), "Filter(File, String) " + filter .getClass ().getName () + " not " + expected + " for null" );
54+ assertEquals (expected , filter .matches (null ), "Filter(File, String) " + filter .getClass ().getName () + " not " + expected + " for null" );
5955 }
6056 // Just don't blow up
6157 assertNotNull (filter .toString ());
@@ -72,11 +68,10 @@ public void assertFiltering(final IOFileFilter filter, final Path path, final bo
7268
7369 if (path != null && path .getParent () != null ) {
7470 assertEquals (expectedFileVisitResult , filter .accept (path , null ),
75- "Filter(Path, Path) " + filter .getClass ().getName () + " not " + expectedFileVisitResult + " for "
76- + path );
71+ "Filter(Path, Path) " + filter .getClass ().getName () + " not " + expectedFileVisitResult + " for " + path );
7772 } else if (path == null ) {
7873 assertEquals (expectedFileVisitResult , filter .accept (path , null ),
79- "Filter(Path, Path) " + filter .getClass ().getName () + " not " + expectedFileVisitResult + " for null" );
74+ "Filter(Path, Path) " + filter .getClass ().getName () + " not " + expectedFileVisitResult + " for null" );
8075 }
8176 // Just don't blow up
8277 assertNotNull (filter .toString ());
@@ -167,8 +162,12 @@ public void testRegexFileNameOnly() throws IOException {
167162 assertFiltering (assertSerializable (new RegexFileFilter (patternStr )), path , true );
168163 assertFiltering (assertSerializable (new RegexFileFilter (Pattern .compile (patternStr ), (Function <Path , String > & Serializable ) Path ::toString )), path ,
169164 false );
165+ //
170166 assertFiltering (new RegexFileFilter (Pattern .compile (patternStr ), (Function <Path , String > & Serializable ) null ), path , false );
171167 assertFiltering (new RegexFileFilter (Pattern .compile (patternStr ), (Function <Path , String > & Serializable ) p -> null ), path , false );
168+ //
169+ assertFiltering (assertSerializable (new RegexFileFilter (Pattern .compile (patternStr ), (Function <Path , String > & Serializable ) null )), path , false );
170+ assertFiltering (assertSerializable (new RegexFileFilter (Pattern .compile (patternStr ), (Function <Path , String > & Serializable ) p -> null )), path , false );
172171 }
173172
174173}
0 commit comments