You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/08/15 02:16:20 UTC
[commons-io] branch master updated: Add comment.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git
The following commit(s) were added to refs/heads/master by this push:
new 0c0858c Add comment.
0c0858c is described below
commit 0c0858c4fabacb85ca6f805b856b97649f92ccd9
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Aug 14 22:16:12 2020 -0400
Add comment.
---
.../commons/io/FileUtilsCleanDirectoryTestCase.java | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/test/java/org/apache/commons/io/FileUtilsCleanDirectoryTestCase.java b/src/test/java/org/apache/commons/io/FileUtilsCleanDirectoryTestCase.java
index c612efa..b44d18c 100644
--- a/src/test/java/org/apache/commons/io/FileUtilsCleanDirectoryTestCase.java
+++ b/src/test/java/org/apache/commons/io/FileUtilsCleanDirectoryTestCase.java
@@ -23,6 +23,7 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
@@ -34,13 +35,15 @@ import org.junit.jupiter.api.io.TempDir;
/**
* Test cases for FileUtils.cleanDirectory() method.
*
+ * TODO Redo this test using
+ * {@link Files#createSymbolicLink(java.nio.file.Path, java.nio.file.Path, java.nio.file.attribute.FileAttribute...)}.
*/
public class FileUtilsCleanDirectoryTestCase {
@TempDir
public File top;
- //-----------------------------------------------------------------------
+ // -----------------------------------------------------------------------
@Test
public void testCleanEmpty() throws Exception {
assertEquals(0, top.list().length);
@@ -89,8 +92,7 @@ public class FileUtilsCleanDirectoryTestCase {
FileUtils.cleanDirectory(top);
fail("expected IOException");
} catch (final IOException e) {
- assertEquals("Failed to list contents of " +
- top.getAbsolutePath(), e.getMessage());
+ assertEquals("Failed to list contents of " + top.getAbsolutePath(), e.getMessage());
} finally {
chmod(top, 755, false);
}
@@ -109,16 +111,14 @@ public class FileUtilsCleanDirectoryTestCase {
FileUtils.cleanDirectory(top);
fail("expected IOException");
} catch (final IOException e) {
- assertEquals("Unable to delete file: " +
- file.getAbsolutePath(), e.getMessage());
+ assertEquals("Unable to delete file: " + file.getAbsolutePath(), e.getMessage());
} finally {
chmod(top, 755, false);
}
}
/** Only runs on Linux. */
- private boolean chmod(final File file, final int mode, final boolean recurse)
- throws InterruptedException {
+ private boolean chmod(final File file, final int mode, final boolean recurse) throws InterruptedException {
final List<String> args = new ArrayList<>();
args.add("chmod");
@@ -132,8 +132,7 @@ public class FileUtilsCleanDirectoryTestCase {
Process proc;
try {
- proc = Runtime.getRuntime().exec(
- args.toArray(new String[args.size()]));
+ proc = Runtime.getRuntime().exec(args.toArray(new String[args.size()]));
} catch (final IOException e) {
return false;
}