@@ -69,10 +69,10 @@ public class FilesUncheckTest {
6969
7070 private static final FileAttribute <?>[] EMPTY_FILE_ATTRIBUTES_ARRAY = {};
7171
72- private static final Path FILE_PATH_EMPTY = Paths .get ("src/test/resources/org/apache/commons/io/test-file-empty.bin" );
73-
7472 private static final Path FILE_PATH_A = Paths .get ("src/test/resources/org/apache/commons/io/dirs-1-file-size-1/file-size-1.bin" );
7573
74+ private static final Path FILE_PATH_EMPTY = Paths .get ("src/test/resources/org/apache/commons/io/test-file-empty.bin" );
75+
7676 private static final Path NEW_DIR_PATH = Paths .get ("target/newdir" );
7777
7878 private static final Path NEW_FILE_PATH = Paths .get ("target/file.txt" );
@@ -293,18 +293,18 @@ public void testNewDirectoryStreamPath() {
293293 }
294294
295295 @ Test
296- public void testNewDirectoryStreamPathString () {
296+ public void testNewDirectoryStreamPathFilterOfQsuperPath () {
297297 Uncheck .run (() -> {
298- try (final DirectoryStream <Path > directoryStream = FilesUncheck .newDirectoryStream (TARGET_PATH , "*.xml" )) {
298+ try (final DirectoryStream <Path > directoryStream = FilesUncheck .newDirectoryStream (TARGET_PATH , e -> true )) {
299299 directoryStream .forEach (e -> assertEquals (TARGET_PATH , e .getParent ()));
300300 }
301301 });
302302 }
303303
304304 @ Test
305- public void testNewDirectoryStreamPathFilterOfQsuperPath () {
305+ public void testNewDirectoryStreamPathString () {
306306 Uncheck .run (() -> {
307- try (final DirectoryStream <Path > directoryStream = FilesUncheck .newDirectoryStream (TARGET_PATH , e -> true )) {
307+ try (final DirectoryStream <Path > directoryStream = FilesUncheck .newDirectoryStream (TARGET_PATH , "*.xml" )) {
308308 directoryStream .forEach (e -> assertEquals (TARGET_PATH , e .getParent ()));
309309 }
310310 });
@@ -332,13 +332,18 @@ public void testNewOutputStream() {
332332
333333 @ Test
334334 public void testProbeContentType () {
335- @ SuppressWarnings ( "unused" )
335+ // Empty file:
336336 String probeContentType = FilesUncheck .probeContentType (FILE_PATH_EMPTY );
337337 // Empirical: probeContentType is null on Windows
338338 // Empirical: probeContentType is "text/plain" on Ubuntu
339+ // Empirical: probeContentType is ? on macOS
340+ //
341+ // BOM file:
339342 probeContentType = FilesUncheck .probeContentType (Paths .get ("src/test/resources/org/apache/commons/io/testfileBOM.xml" ));
340- assertTrue ("text/xml" .equals (probeContentType ) || "application/xml" .equals (probeContentType ));
341-
343+ // Empirical: probeContentType is "text/plain" on Windows
344+ // Empirical: probeContentType is "application/plain" on Ubuntu
345+ // Empirical: probeContentType is ? on macOS
346+ assertNotNull (probeContentType );
342347 }
343348
344349 @ Test
@@ -406,23 +411,23 @@ public void testSize() {
406411 }
407412
408413 @ Test
409- public void testWalkPathIntFileVisitOptionArray () {
410- assertEquals (1 , FilesUncheck .walk (TARGET_PATH , 0 , FileVisitOption . FOLLOW_LINKS ). count ( ));
414+ public void testWalkFileTreePathFileVisitorOfQsuperPath () {
415+ assertEquals (TARGET_PATH , FilesUncheck .walkFileTree (TARGET_PATH , NoopPathVisitor . INSTANCE ));
411416 }
412417
413418 @ Test
414- public void testWalkPathFileVisitOptionArray () {
415- assertTrue ( 0 < FilesUncheck .walk (TARGET_PATH , FileVisitOption . FOLLOW_LINKS ). count ( ));
419+ public void testWalkFileTreePathSetOfFileVisitOptionIntFileVisitorOfQsuperPath () {
420+ assertEquals ( TARGET_PATH , FilesUncheck .walkFileTree (TARGET_PATH , new HashSet <>(), 1 , NoopPathVisitor . INSTANCE ));
416421 }
417422
418423 @ Test
419- public void testWalkFileTreePathFileVisitorOfQsuperPath () {
420- assertEquals ( TARGET_PATH , FilesUncheck .walkFileTree (TARGET_PATH , NoopPathVisitor . INSTANCE ));
424+ public void testWalkPathFileVisitOptionArray () {
425+ assertTrue ( 0 < FilesUncheck .walk (TARGET_PATH , FileVisitOption . FOLLOW_LINKS ). count ( ));
421426 }
422427
423428 @ Test
424- public void testWalkFileTreePathSetOfFileVisitOptionIntFileVisitorOfQsuperPath () {
425- assertEquals (TARGET_PATH , FilesUncheck .walkFileTree (TARGET_PATH , new HashSet <>(), 1 , NoopPathVisitor . INSTANCE ));
429+ public void testWalkPathIntFileVisitOptionArray () {
430+ assertEquals (1 , FilesUncheck .walk (TARGET_PATH , 0 , FileVisitOption . FOLLOW_LINKS ). count ( ));
426431 }
427432
428433 @ Test
0 commit comments