Skip to content

Commit 68374b2

Browse files
Remove setUp and tearDown methods that are no longer necessary after the switch to the TemporaryFolder rule.
1 parent 99a353b commit 68374b2

8 files changed

Lines changed: 0 additions & 77 deletions

File tree

src/test/java/org/apache/commons/io/FileDeleteStrategyTestCase.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import java.io.IOException;
2828

2929
import org.apache.commons.io.testtools.TestUtils;
30-
import org.junit.After;
3130
import org.junit.Rule;
3231
import org.junit.Test;
3332
import org.junit.rules.TemporaryFolder;
@@ -160,10 +159,4 @@ public void testToString() {
160159
assertEquals("FileDeleteStrategy[Normal]", FileDeleteStrategy.NORMAL.toString());
161160
assertEquals("FileDeleteStrategy[Force]", FileDeleteStrategy.FORCE.toString());
162161
}
163-
164-
@After
165-
public void tearDown() throws Exception {
166-
FileUtils.deleteDirectory(getTestDirectory());
167-
}
168-
169162
}

src/test/java/org/apache/commons/io/FilenameUtilsTestCase.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.util.Collection;
3131

3232
import org.apache.commons.io.testtools.TestUtils;
33-
import org.junit.After;
3433
import org.junit.Before;
3534
import org.junit.Rule;
3635
import org.junit.Test;
@@ -46,10 +45,6 @@ public class FilenameUtilsTestCase {
4645
@Rule
4746
public TemporaryFolder temporaryFolder = new TemporaryFolder();
4847

49-
private File getTestDirectory() {
50-
return temporaryFolder.getRoot();
51-
}
52-
5348
private static final String SEP = "" + File.separatorChar;
5449
private static final boolean WINDOWS = File.separatorChar == '\\';
5550

@@ -59,9 +54,6 @@ private File getTestDirectory() {
5954
private int testFile1Size;
6055
private int testFile2Size;
6156

62-
/**
63-
* @see junit.framework.TestCase#setUp()
64-
*/
6557
@Before
6658
public void setUp() throws Exception {
6759
testFile1 = temporaryFolder.newFile("file1-test.txt");
@@ -103,14 +95,6 @@ public void setUp() throws Exception {
10395
}
10496
}
10597

106-
/**
107-
* @see junit.framework.TestCase#tearDown()
108-
*/
109-
@After
110-
public void tearDown() throws Exception {
111-
temporaryFolder.delete();
112-
}
113-
11498
//-----------------------------------------------------------------------
11599
@Test
116100
public void testNormalize() throws Exception {

src/test/java/org/apache/commons/io/comparator/ComparatorAbstractTestCase.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import java.util.Comparator;
2828
import java.util.List;
2929

30-
import org.apache.commons.io.FileUtils;
31-
import org.junit.After;
3230
import org.junit.Rule;
3331
import org.junit.Test;
3432
import org.junit.rules.TemporaryFolder;
@@ -63,18 +61,6 @@ protected File getTestDirectory() {
6361
/** File which is more than the "lessFile" */
6462
protected File moreFile;
6563

66-
/** @see junit.framework.TestCase#tearDown() */
67-
@After
68-
public void tearDown() throws Exception {
69-
comparator = null;
70-
reverse = null;
71-
equalFile1 = null;
72-
equalFile2 = null;
73-
lessFile = null;
74-
moreFile = null;
75-
FileUtils.deleteDirectory(getTestDirectory());
76-
}
77-
7864
/**
7965
* Test the comparator.
8066
*/

src/test/java/org/apache/commons/io/filefilter/FileFilterTestCase.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
import org.apache.commons.io.IOCase;
4444
import org.apache.commons.io.IOUtils;
4545
import org.apache.commons.io.testtools.TestUtils;
46-
import org.junit.After;
47-
import org.junit.Before;
4846
import org.junit.Rule;
4947
import org.junit.Test;
5048
import org.junit.rules.TemporaryFolder;
@@ -68,16 +66,6 @@ private File getTestDirectory() {
6866

6967
private static final boolean WINDOWS = File.separatorChar == '\\';
7068

71-
@Before
72-
public void setUp() {
73-
getTestDirectory();
74-
}
75-
76-
@After
77-
public void tearDown() throws Exception {
78-
FileUtils.deleteDirectory(getTestDirectory());
79-
}
80-
8169
public void assertFiltering(final IOFileFilter filter, final File file, final boolean expected) throws Exception {
8270
// Note. This only tests the (File, String) version if the parent of
8371
// the File passed in is not null

src/test/java/org/apache/commons/io/input/TailerTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,7 @@ private File getTestDirectory() {
7070
public void tearDown() throws Exception {
7171
if (tailer != null) {
7272
tailer.stop();
73-
TestUtils.sleep(1000);
7473
}
75-
FileUtils.deleteDirectory(getTestDirectory());
76-
TestUtils.sleep(1000);
7774
}
7875

7976
@Test

src/test/java/org/apache/commons/io/monitor/AbstractMonitorTestCase.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.apache.commons.io.filefilter.FileFilterUtils;
2828
import org.apache.commons.io.filefilter.HiddenFileFilter;
2929
import org.apache.commons.io.filefilter.IOFileFilter;
30-
import org.junit.After;
3130
import org.junit.Before;
3231

3332
/**
@@ -89,11 +88,6 @@ protected void createObserver(final File file, final FileFilter fileFilter) {
8988
}
9089
}
9190

92-
@After
93-
public void tearDown() throws Exception {
94-
FileUtils.deleteDirectory(testDir);
95-
}
96-
9791
/**
9892
* Check all the Collections are empty
9993
*

src/test/java/org/apache/commons/io/output/FileWriterWithEncodingTest.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
import java.nio.charset.Charset;
3131
import java.nio.charset.CharsetEncoder;
3232

33-
import org.apache.commons.io.FileUtils;
3433
import org.apache.commons.io.IOUtils;
35-
import org.junit.After;
3634
import org.junit.Before;
3735
import org.junit.Rule;
3836
import org.junit.Test;
@@ -79,13 +77,6 @@ public void setUp() {
7977
textContent = new String(arr);
8078
}
8179

82-
@After
83-
public void tearDown() throws Exception {
84-
FileUtils.deleteDirectory(getTestDirectory());
85-
defaultEncoding = null;
86-
textContent = null;
87-
}
88-
8980
//-----------------------------------------------------------------------
9081
@Test
9182
public void sameEncoding_string_constructor() throws Exception {

src/test/java/org/apache/commons/io/output/LockableFileWriterTest.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
import java.nio.charset.StandardCharsets;
2727
import java.nio.charset.UnsupportedCharsetException;
2828

29-
import org.apache.commons.io.FileUtils;
30-
import org.junit.After;
3129
import org.junit.Before;
3230
import org.junit.Rule;
3331
import org.junit.Test;
@@ -62,14 +60,6 @@ public void setUp() {
6260
altLockFile = new File(altLockDir, file.getName() + ".lck");
6361
}
6462

65-
@After
66-
public void tearDown() throws IOException {
67-
file.delete();
68-
lockFile.delete();
69-
altLockFile.delete();
70-
FileUtils.deleteDirectory(altLockDir);
71-
}
72-
7363
//-----------------------------------------------------------------------
7464
@Test public void testFileLocked() throws IOException {
7565

0 commit comments

Comments
 (0)