From 576948106e264e5fb0ffecd1e1916bb534bd42ca Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Mon, 24 Feb 2020 10:38:46 -0500 Subject: [PATCH] [MSHARED-685] assert some things (#16) * assert some things --- .../shared/utils/io/DirectoryScannerTest.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/apache/maven/shared/utils/io/DirectoryScannerTest.java b/src/test/java/org/apache/maven/shared/utils/io/DirectoryScannerTest.java index e331db9d..a6149a3f 100644 --- a/src/test/java/org/apache/maven/shared/utils/io/DirectoryScannerTest.java +++ b/src/test/java/org/apache/maven/shared/utils/io/DirectoryScannerTest.java @@ -50,7 +50,10 @@ private void createTestData() { File rootDir = tempFolder.getRoot(); File folder1 = new File( rootDir, "folder1" ); - folder1.mkdirs(); + if ( !folder1.mkdirs() ) + { + Assert.fail(); + } FileTestHelper.generateTestFile( new File( rootDir, "file1.txt" ), 11 ); FileTestHelper.generateTestFile( new File( rootDir, "file2.txt" ), 12 ); @@ -60,7 +63,10 @@ private void createTestData() FileTestHelper.generateTestFile( new File( folder1, "file5.dat" ), 15 ); File folder2 = new File( folder1, "ignorefolder" ); - folder2.mkdirs(); + if ( !folder2.mkdirs() ) + { + Assert.fail(); + } FileTestHelper.generateTestFile( new File( folder2, "file7.txt" ), 17 ); } @@ -131,11 +137,9 @@ public void checkSymlinkBehaviour() ds.scan(); String[] includedDirectories = ds.getIncludedDirectories(); String[] files = ds.getIncludedFiles(); - - //FIXME: This should be changed to some kind of assert...WhatEver()... - System.out.println( "files = " + files ); - - + assertAlwaysIncluded( Arrays.asList( files ) ); + assertEquals( 5, includedDirectories.length ); + assertEquals( 9, files.length ); } @Test @@ -155,7 +159,7 @@ public void followSymlinksFalse() assertAlwaysIncluded( included ); assertEquals( 9, included.size() ); List includedDirs = Arrays.asList( ds.getIncludedDirectories() ); - assertTrue( includedDirs.contains( "" ) ); // w00t ! + assertTrue( includedDirs.contains( "" ) ); assertTrue( includedDirs.contains( "aRegularDir" ) ); assertTrue( includedDirs.contains( "symDir" ) ); assertTrue( includedDirs.contains( "symLinkToDirOnTheOutside" ) );