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 2021/09/19 15:36:02 UTC

[commons-io] branch master updated: Refactor commons code.

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 e95c77c  Refactor commons code.
e95c77c is described below

commit e95c77c48c15243128da550f068b8c25cedefb0f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Sep 19 11:35:57 2021 -0400

    Refactor commons code.
---
 .../org/apache/commons/io/FileCleaningTrackerTestCase.java    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java b/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
index b4fc722..7fd0fb9 100644
--- a/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
+++ b/src/test/java/org/apache/commons/io/FileCleaningTrackerTestCase.java
@@ -24,6 +24,7 @@ import static org.junit.jupiter.api.Assertions.fail;
 
 import java.io.BufferedOutputStream;
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.lang.ref.ReferenceQueue;
@@ -50,6 +51,10 @@ public class FileCleaningTrackerTestCase {
     private File testFile;
 
     private FileCleaningTracker theInstance;
+    public RandomAccessFile createRandomAccessFile() throws FileNotFoundException {
+        return new RandomAccessFile(testFile, "rw");
+    }
+
     protected FileCleaningTracker newInstance() {
         return new FileCleaningTracker();
     }
@@ -195,7 +200,7 @@ public class FileCleaningTrackerTestCase {
         final String path = testFile.getPath();
 
         assertFalse(testFile.exists(), "1-testFile exists: " + testFile);
-        RandomAccessFile r = new RandomAccessFile(testFile, "rw");
+        RandomAccessFile r = createRandomAccessFile();
         assertTrue(testFile.exists(), "2-testFile exists");
 
         assertEquals(0, theInstance.getTrackCount(), "3-Track Count");
@@ -227,7 +232,7 @@ public class FileCleaningTrackerTestCase {
         final String path = testFile.getPath();
 
         assertFalse(testFile.exists());
-        RandomAccessFile r = new RandomAccessFile(testFile, "rw");
+        RandomAccessFile r = createRandomAccessFile();
         assertTrue(testFile.exists());
 
         assertEquals(0, theInstance.getTrackCount());
@@ -276,7 +281,7 @@ public class FileCleaningTrackerTestCase {
         final String path = testFile.getPath();
 
         assertFalse(testFile.exists());
-        RandomAccessFile r = new RandomAccessFile(testFile, "rw");
+        RandomAccessFile r = createRandomAccessFile();
         assertTrue(testFile.exists());
 
         assertEquals(0, theInstance.getTrackCount());