From 3d01167433c5150008f53381d4c9b56415a758de Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Sun, 23 Feb 2020 17:56:16 -0500 Subject: [PATCH 1/4] assert some things --- .../shared/utils/io/DirectoryScannerTest.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 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..7f1f34e9 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 ); + Assert.assertEquals( 9, files.length ); } @Test @@ -155,11 +159,6 @@ public void followSymlinksFalse() assertAlwaysIncluded( included ); assertEquals( 9, included.size() ); List includedDirs = Arrays.asList( ds.getIncludedDirectories() ); - assertTrue( includedDirs.contains( "" ) ); // w00t ! - assertTrue( includedDirs.contains( "aRegularDir" ) ); - assertTrue( includedDirs.contains( "symDir" ) ); - assertTrue( includedDirs.contains( "symLinkToDirOnTheOutside" ) ); - assertTrue( includedDirs.contains( "targetDir" ) ); assertEquals( 5, includedDirs.size() ); } From eac2d72441ffec13ccff481f9918505852cb0b0a Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Sun, 23 Feb 2020 17:57:55 -0500 Subject: [PATCH 2/4] assert some things --- .../org/apache/maven/shared/utils/io/DirectoryScannerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 7f1f34e9..558dfedb 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 @@ -139,7 +139,7 @@ public void checkSymlinkBehaviour() String[] files = ds.getIncludedFiles(); assertAlwaysIncluded( Arrays.asList( files ) ); assertEquals( 5, includedDirectories.length ); - Assert.assertEquals( 9, files.length ); + assertEquals( 9, files.length ); } @Test From 8d00171646244b8a6045375d9fb05e86f9fb5f6d Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Sun, 23 Feb 2020 17:59:45 -0500 Subject: [PATCH 3/4] restore asserts --- .../apache/maven/shared/utils/io/DirectoryScannerTest.java | 5 +++++ 1 file changed, 5 insertions(+) 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 558dfedb..3b6da377 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 @@ -159,6 +159,11 @@ public void followSymlinksFalse() assertAlwaysIncluded( included ); assertEquals( 9, included.size() ); List includedDirs = Arrays.asList( ds.getIncludedDirectories() ); + assertTrue( includedDirs.contains( "" ) ); + assertTrue( includedDirs.contains( "aRegularDir" ) ); + assertTrue( includedDirs.contains( "symDir" ) ); + assertTrue( includedDirs.contains( "symLinkToDirOnTheOutside" ) ); + assertTrue( includedDirs.contains( "targetDir" ) ); assertEquals( 5, includedDirs.size() ); } From 0c8eb48d334566c82f92406099459135010e16cb Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Mon, 24 Feb 2020 09:35:57 -0500 Subject: [PATCH 4/4] add spaces --- .../maven/shared/utils/io/DirectoryScannerTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 3b6da377..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,10 +50,10 @@ private void createTestData() { File rootDir = tempFolder.getRoot(); File folder1 = new File( rootDir, "folder1" ); - if (!folder1.mkdirs()) + if ( !folder1.mkdirs() ) { Assert.fail(); - }; + } FileTestHelper.generateTestFile( new File( rootDir, "file1.txt" ), 11 ); FileTestHelper.generateTestFile( new File( rootDir, "file2.txt" ), 12 ); @@ -63,10 +63,10 @@ private void createTestData() FileTestHelper.generateTestFile( new File( folder1, "file5.dat" ), 15 ); File folder2 = new File( folder1, "ignorefolder" ); - if (!folder2.mkdirs()) + if ( !folder2.mkdirs() ) { Assert.fail(); - }; + } FileTestHelper.generateTestFile( new File( folder2, "file7.txt" ), 17 ); }