remove TemporaryFolder Rule from test classes that do not use it
MODIFY
src/test/java/org/apache/commons/io/CopyUtilsTest.java
src/test/java/org/apache/commons/io/CopyUtilsTest.java
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
-import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import org.apache.commons.io.testtools.TestUtils;
import org.apache.commons.io.testtools.YellOnCloseInputStream;
import org.apache.commons.io.testtools.YellOnFlushAndCloseOutputStream;
-import org.junit.ClassRule;
import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
@SuppressWarnings("deprecation") // these are test cases for the deprecated CopyUtils
*/
public class CopyUtilsTest {
- @ClassRule
- public static TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- private static File getTestDirectory() {
- return temporaryFolder.getRoot();
- }
-
/*
* NOTE this is not particularly beautiful code. A better way to check for
* flush and close status would be to implement "trojan horse" wrapper
@@ -61,7 +51,6 @@ private static File getTestDirectory() {
private static final int FILE_SIZE = 1024 * 4 + 1;
-
private final byte[] inData = TestUtils.generateTestData(FILE_SIZE);
// ----------------------------------------------------------------

MODIFY
src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java
src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java
import java.util.Locale;
import org.junit.Assert;
-import org.junit.ClassRule;
import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
/**
* This is used to test FileSystemUtils.
*/
public class FileSystemUtilsTestCase {
- @ClassRule
- public static TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- private static File getTestDirectory() {
- return temporaryFolder.getRoot();
- }
-
//-----------------------------------------------------------------------
@Test
@SuppressWarnings("deprecation") // testing decrecated code

MODIFY
src/test/java/org/apache/commons/io/IOCaseTestCase.java
src/test/java/org/apache/commons/io/IOCaseTestCase.java
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import org.junit.ClassRule;
import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
/**
* This is used to test IOCase for correctness.
*/
public class IOCaseTestCase {
- @ClassRule
- public static TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- private static File getTestDirectory() {
- return temporaryFolder.getRoot();
- }
-
private static final boolean WINDOWS = File.separatorChar == '\\';
//-----------------------------------------------------------------------

MODIFY
src/test/java/org/apache/commons/io/IOUtilsCopyTestCase.java
src/test/java/org/apache/commons/io/IOUtilsCopyTestCase.java
import org.apache.commons.io.testtools.TestUtils;
import org.apache.commons.io.testtools.YellOnCloseInputStream;
import org.apache.commons.io.testtools.YellOnFlushAndCloseOutputStream;
-import org.junit.ClassRule;
import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
/**
* JUnit tests for IOUtils copy methods.
*/
public class IOUtilsCopyTestCase {
- @ClassRule
- public static TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- private static File getTestDirectory() {
- return temporaryFolder.getRoot();
- }
-
/*
* NOTE this is not particularly beautiful code. A better way to check for
* flush and close status would be to implement "trojan horse" wrapper

MODIFY
src/test/java/org/apache/commons/io/IOUtilsWriteTestCase.java
src/test/java/org/apache/commons/io/IOUtilsWriteTestCase.java
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import java.io.File;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.commons.io.testtools.TestUtils;
import org.apache.commons.io.testtools.YellOnFlushAndCloseOutputStream;
-import org.junit.ClassRule;
import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
/**
* JUnit tests for IOUtils write methods.
@SuppressWarnings("deprecation") // includes tests for deprecated methods
public class IOUtilsWriteTestCase {
- @ClassRule
- public static TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- private static File getTestDirectory() {
- return temporaryFolder.getRoot();
- }
-
private static final int FILE_SIZE = 1024 * 4 + 1;
private final byte[] inData = TestUtils.generateTestData(FILE_SIZE);

remove TemporaryFolder Rule from test classes that do not use it