Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsTestCase.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsTestCase.java?rev=1718944&r1=1718943&r2=1718944&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsTestCase.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsTestCase.java
 Wed Dec  9 19:50:30 2015
@@ -16,41 +16,28 @@
  */
 package org.apache.commons.io;
 
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.CharArrayReader;
-import java.io.CharArrayWriter;
-import java.io.Closeable;
-import java.io.EOFException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.Writer;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
+import org.apache.commons.io.testtools.FileBasedTestCase;
+import org.apache.commons.io.testtools.TestUtils;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.*;
+import java.net.*;
 import java.nio.ByteBuffer;
 import java.nio.channels.FileChannel;
 import java.nio.channels.Selector;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.io.testtools.FileBasedTestCase;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
  * This is used to test IOUtils for correctness. The following checks are 
performed:
@@ -80,22 +67,28 @@ public class IOUtilsTestCase extends Fil
 
     private File m_testFile;
 
-    public IOUtilsTestCase(final String name) {
-        super(name);
-    }
-
     /** Assert that the contents of two byte arrays are the same. */
     private void assertEqualContent(final byte[] b0, final byte[] b1) {
         assertTrue("Content not equal according to java.util.Arrays#equals()", 
Arrays.equals(b0, b1));
     }
 
-    @Override
+    @Before
     public void setUp() {
         try {
             getTestDirectory().mkdirs();
             m_testFile = new File(getTestDirectory(), "file2-test.txt");
 
-            createFile(m_testFile, FILE_SIZE);
+            if (!m_testFile.getParentFile().exists()) {
+                throw new IOException("Cannot create file " + m_testFile
+                        + " as the parent directory does not exist");
+            }
+            final BufferedOutputStream output =
+                    new BufferedOutputStream(new FileOutputStream(m_testFile));
+            try {
+                TestUtils.generateTestData(output, (long) FILE_SIZE);
+            } finally {
+                IOUtils.closeQuietly(output);
+            }
         } catch (final IOException ioe) {
             throw new RuntimeException("Can't run this test because the 
environment could not be built: "
                     + ioe.getMessage());
@@ -113,7 +106,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    @Override
+    @After
     public void tearDown() {
         carr = null;
         iarr = null;
@@ -124,7 +117,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testCloseQuietly_AllCloseableIOException() {
+    @Test public void testCloseQuietly_AllCloseableIOException() {
         final Closeable closeable = new Closeable() {
             public void close() throws IOException {
                 throw new IOException();
@@ -133,7 +126,7 @@ public class IOUtilsTestCase extends Fil
         IOUtils.closeQuietly(closeable, null, closeable);
     }
 
-    public void testCloseQuietly_CloseableIOException() {
+    @Test public void testCloseQuietly_CloseableIOException() {
         IOUtils.closeQuietly(new Closeable() {
             public void close() throws IOException {
                 throw new IOException();
@@ -141,17 +134,17 @@ public class IOUtilsTestCase extends Fil
         });
     }
 
-    public void testCloseQuietly_Selector() {
+    @Test public void testCloseQuietly_Selector() {
         Selector selector = null;
         try {
             selector = Selector.open();
-        } catch (final IOException e) {
+        } catch (final IOException ignore) {
         } finally {
             IOUtils.closeQuietly(selector);
         }
     }
 
-    public void testCloseQuietly_SelectorIOException() {
+    @Test public void testCloseQuietly_SelectorIOException() {
         final Selector selector = new SelectorAdapter() {
             @Override
             public void close() throws IOException {
@@ -161,28 +154,28 @@ public class IOUtilsTestCase extends Fil
         IOUtils.closeQuietly(selector);
     }
 
-    public void testCloseQuietly_SelectorNull() {
+    @Test public void testCloseQuietly_SelectorNull() {
         final Selector selector = null;
         IOUtils.closeQuietly(selector);
     }
 
-    public void testCloseQuietly_SelectorTwice() {
+    @Test public void testCloseQuietly_SelectorTwice() {
         Selector selector = null;
         try {
             selector = Selector.open();
-        } catch (final IOException e) {
+        } catch (final IOException ignore) {
         } finally {
             IOUtils.closeQuietly(selector);
             IOUtils.closeQuietly(selector);
         }
     }
 
-    public void testCloseQuietly_ServerSocket() throws IOException {
+    @Test public void testCloseQuietly_ServerSocket() throws IOException {
         IOUtils.closeQuietly((ServerSocket) null);
         IOUtils.closeQuietly(new ServerSocket());
     }
 
-    public void testCloseQuietly_ServerSocketIOException() throws IOException {
+    @Test public void testCloseQuietly_ServerSocketIOException() throws 
IOException {
         IOUtils.closeQuietly(new ServerSocket() {
             @Override
             public void close() throws IOException {
@@ -191,12 +184,12 @@ public class IOUtilsTestCase extends Fil
         });
     }
 
-    public void testCloseQuietly_Socket() {
+    @Test public void testCloseQuietly_Socket() {
         IOUtils.closeQuietly((Socket) null);
         IOUtils.closeQuietly(new Socket());
     }
 
-    public void testCloseQuietly_SocketIOException() {
+    @Test public void testCloseQuietly_SocketIOException() {
         IOUtils.closeQuietly(new Socket() {
             @Override
             public synchronized void close() throws IOException {
@@ -205,7 +198,7 @@ public class IOUtilsTestCase extends Fil
         });
     }
 
-    public void testConstants() throws Exception {
+    @Test public void testConstants() throws Exception {
         assertEquals('/', IOUtils.DIR_SEPARATOR_UNIX);
         assertEquals('\\', IOUtils.DIR_SEPARATOR_WINDOWS);
         assertEquals("\n", IOUtils.LINE_SEPARATOR_UNIX);
@@ -220,7 +213,7 @@ public class IOUtilsTestCase extends Fil
     }
 
     @SuppressWarnings("deprecation") // unavoidable until Java 7
-    public void testContentEquals_InputStream_InputStream() throws Exception {
+    @Test public void testContentEquals_InputStream_InputStream() throws 
Exception {
         {
             final ByteArrayInputStream input1 = new 
ByteArrayInputStream("".getBytes(Charsets.UTF_8));
             assertTrue(IOUtils.contentEquals(input1, input1));
@@ -241,7 +234,7 @@ public class IOUtilsTestCase extends Fil
                 new ByteArrayInputStream("ABCD".getBytes(Charsets.UTF_8))));
     }
 
-    public void testContentEquals_Reader_Reader() throws Exception {
+    @Test public void testContentEquals_Reader_Reader() throws Exception {
         {
             final StringReader input1 = new StringReader("");
             assertTrue(IOUtils.contentEquals(input1, input1));
@@ -257,7 +250,7 @@ public class IOUtilsTestCase extends Fil
         assertFalse(IOUtils.contentEquals(new StringReader("ABC"), new 
StringReader("ABCD")));
     }
 
-    public void testContentEqualsIgnoreEOL() throws Exception {
+    @Test public void testContentEqualsIgnoreEOL() throws Exception {
         {
             final Reader input1 = new CharArrayReader("".toCharArray());
             assertTrue(IOUtils.contentEqualsIgnoreEOL(input1, input1));
@@ -293,8 +286,8 @@ public class IOUtilsTestCase extends Fil
 
     @SuppressWarnings("deprecation")
     // testing deprecated method
-    public void testCopy_ByteArray_OutputStream() throws Exception {
-        final File destination = newFile("copy8.txt");
+    @Test public void testCopy_ByteArray_OutputStream() throws Exception {
+        final File destination = TestUtils.newFile(getTestDirectory(), 
"copy8.txt");
         final FileInputStream fin = new FileInputStream(m_testFile);
         byte[] in;
         try {
@@ -310,18 +303,18 @@ public class IOUtilsTestCase extends Fil
 
             fout.flush();
 
-            checkFile(destination, m_testFile);
-            checkWrite(fout);
+            TestUtils.checkFile(destination, m_testFile);
+            TestUtils.checkWrite(fout);
         } finally {
             fout.close();
         }
-        deleteFile(destination);
+        TestUtils.deleteFile(destination);
     }
 
     @SuppressWarnings("deprecation")
     // testing deprecated method
-    public void testCopy_ByteArray_Writer() throws Exception {
-        final File destination = newFile("copy7.txt");
+    @Test public void testCopy_ByteArray_Writer() throws Exception {
+        final File destination = TestUtils.newFile(getTestDirectory(), 
"copy7.txt");
         final FileInputStream fin = new FileInputStream(m_testFile);
         byte[] in;
         try {
@@ -335,18 +328,18 @@ public class IOUtilsTestCase extends Fil
         try {
             CopyUtils.copy(in, fout);
             fout.flush();
-            checkFile(destination, m_testFile);
-            checkWrite(fout);
+            TestUtils.checkFile(destination, m_testFile);
+            TestUtils.checkWrite(fout);
         } finally {
             fout.close();
         }
-        deleteFile(destination);
+        TestUtils.deleteFile(destination);
     }
 
     @SuppressWarnings("deprecation")
     // testing deprecated method
-    public void testCopy_String_Writer() throws Exception {
-        final File destination = newFile("copy6.txt");
+    @Test public void testCopy_String_Writer() throws Exception {
+        final File destination = TestUtils.newFile(getTestDirectory(), 
"copy6.txt");
         final FileReader fin = new FileReader(m_testFile);
         String str;
         try {
@@ -361,15 +354,15 @@ public class IOUtilsTestCase extends Fil
             CopyUtils.copy(str, fout);
             fout.flush();
 
-            checkFile(destination, m_testFile);
-            checkWrite(fout);
+            TestUtils.checkFile(destination, m_testFile);
+            TestUtils.checkWrite(fout);
         } finally {
             fout.close();
         }
-        deleteFile(destination);
+        TestUtils.deleteFile(destination);
     }
 
-    public void testCopyLarge_CharExtraLength() throws IOException {
+    @Test public void testCopyLarge_CharExtraLength() throws IOException {
         CharArrayReader is = null;
         CharArrayWriter os = null;
         try {
@@ -395,7 +388,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testCopyLarge_CharFullLength() throws IOException {
+    @Test public void testCopyLarge_CharFullLength() throws IOException {
         CharArrayReader is = null;
         CharArrayWriter os = null;
         try {
@@ -420,7 +413,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testCopyLarge_CharNoSkip() throws IOException {
+    @Test public void testCopyLarge_CharNoSkip() throws IOException {
         CharArrayReader is = null;
         CharArrayWriter os = null;
         try {
@@ -445,7 +438,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testCopyLarge_CharSkip() throws IOException {
+    @Test public void testCopyLarge_CharSkip() throws IOException {
         CharArrayReader is = null;
         CharArrayWriter os = null;
         try {
@@ -470,7 +463,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testCopyLarge_CharSkipInvalid() throws IOException {
+    @Test public void testCopyLarge_CharSkipInvalid() throws IOException {
         CharArrayReader is = null;
         CharArrayWriter os = null;
         try {
@@ -481,14 +474,14 @@ public class IOUtilsTestCase extends Fil
             // Test our copy method
             IOUtils.copyLarge(is, os, 1000, 100);
             fail("Should have thrown EOFException");
-        } catch (final EOFException eofe) {
+        } catch (final EOFException ignore) {
         } finally {
             IOUtils.closeQuietly(is);
             IOUtils.closeQuietly(os);
         }
     }
 
-    public void testCopyLarge_ExtraLength() throws IOException {
+    @Test public void testCopyLarge_ExtraLength() throws IOException {
         ByteArrayInputStream is = null;
         ByteArrayOutputStream os = null;
         try {
@@ -514,7 +507,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testCopyLarge_FullLength() throws IOException {
+    @Test public void testCopyLarge_FullLength() throws IOException {
         ByteArrayInputStream is = null;
         ByteArrayOutputStream os = null;
         try {
@@ -539,7 +532,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testCopyLarge_NoSkip() throws IOException {
+    @Test public void testCopyLarge_NoSkip() throws IOException {
         ByteArrayInputStream is = null;
         ByteArrayOutputStream os = null;
         try {
@@ -564,7 +557,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testCopyLarge_Skip() throws IOException {
+    @Test public void testCopyLarge_Skip() throws IOException {
         ByteArrayInputStream is = null;
         ByteArrayOutputStream os = null;
         try {
@@ -589,7 +582,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testCopyLarge_SkipInvalid() throws IOException {
+    @Test public void testCopyLarge_SkipInvalid() throws IOException {
         ByteArrayInputStream is = null;
         ByteArrayOutputStream os = null;
         try {
@@ -600,14 +593,14 @@ public class IOUtilsTestCase extends Fil
             // Test our copy method
             IOUtils.copyLarge(is, os, 1000, 100);
             fail("Should have thrown EOFException");
-        } catch (final EOFException eofe) {
+        } catch (final EOFException ignore) {
         } finally {
             IOUtils.closeQuietly(is);
             IOUtils.closeQuietly(os);
         }
     }
 
-    public void testRead_ReadableByteChannel() throws Exception {
+    @Test public void testRead_ReadableByteChannel() throws Exception {
         final ByteBuffer buffer = ByteBuffer.allocate(FILE_SIZE);
         final FileInputStream fileInputStream = new 
FileInputStream(m_testFile);
         final FileChannel input = fileInputStream.getChannel();
@@ -627,7 +620,7 @@ public class IOUtilsTestCase extends Fil
             IOUtils.closeQuietly(input, fileInputStream);
         }}
 
-    public void testReadFully_InputStream_ByteArray() throws Exception {
+    @Test public void testReadFully_InputStream_ByteArray() throws Exception {
         final int size = 1027;
 
         final byte[] buffer = new byte[size];
@@ -651,7 +644,7 @@ public class IOUtilsTestCase extends Fil
 
     }
 
-    public void testReadFully_InputStream__ReturnByteArray() throws Exception {
+    @Test public void testReadFully_InputStream__ReturnByteArray() throws 
Exception {
         final byte[] bytes = "abcd1234".getBytes("UTF-8");
         final ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
 
@@ -662,7 +655,7 @@ public class IOUtilsTestCase extends Fil
         assertEqualContent(result, bytes);
     }
 
-    public void testReadFully_InputStream_Offset() throws Exception {
+    @Test public void testReadFully_InputStream_Offset() throws Exception {
         final byte[] bytes = "abcd1234".getBytes("UTF-8");
         final ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
         final byte[] buffer = "wx00000000".getBytes("UTF-8");
@@ -671,7 +664,7 @@ public class IOUtilsTestCase extends Fil
         IOUtils.closeQuietly(stream);
     }
 
-    public void testReadFully_ReadableByteChannel() throws Exception {
+    @Test public void testReadFully_ReadableByteChannel() throws Exception {
         final ByteBuffer buffer = ByteBuffer.allocate(FILE_SIZE);
         final FileInputStream fileInputStream = new 
FileInputStream(m_testFile);
         final FileChannel input = fileInputStream.getChannel();
@@ -697,7 +690,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testReadFully_Reader() throws Exception {
+    @Test public void testReadFully_Reader() throws Exception {
         final int size = 1027;
 
         final char[] buffer = new char[size];
@@ -720,7 +713,7 @@ public class IOUtilsTestCase extends Fil
         IOUtils.closeQuietly(input);
     }
 
-    public void testReadFully_Reader_Offset() throws Exception {
+    @Test public void testReadFully_Reader_Offset() throws Exception {
         final Reader reader = new StringReader("abcd1234");
         final char[] buffer = "wx00000000".toCharArray();
         IOUtils.readFully(reader, buffer, 2, 8);
@@ -729,12 +722,12 @@ public class IOUtilsTestCase extends Fil
     }
 
     @SuppressWarnings("deprecation") // deliberately testing deprecated method
-    public void testReadLines_InputStream() throws Exception {
-        final File file = newFile("lines.txt");
+    @Test public void testReadLines_InputStream() throws Exception {
+        final File file = TestUtils.newFile(getTestDirectory(), "lines.txt");
         InputStream in = null;
         try {
             final String[] data = new String[] { "hello", "world", "", "this 
is", "some text" };
-            createLineBasedFile(file, data);
+            TestUtils.createLineBasedFile(file, data);
 
             in = new FileInputStream(file);
             final List<String> lines = IOUtils.readLines(in);
@@ -742,16 +735,16 @@ public class IOUtilsTestCase extends Fil
             assertEquals(-1, in.read());
         } finally {
             IOUtils.closeQuietly(in);
-            deleteFile(file);
+            TestUtils.deleteFile(file);
         }
     }
 
-    public void testReadLines_InputStream_String() throws Exception {
-        final File file = newFile("lines.txt");
+    @Test public void testReadLines_InputStream_String() throws Exception {
+        final File file = TestUtils.newFile(getTestDirectory(), "lines.txt");
         InputStream in = null;
         try {
             final String[] data = new String[] { "hello", "/u1234", "", "this 
is", "some text" };
-            createLineBasedFile(file, data);
+            TestUtils.createLineBasedFile(file, data);
 
             in = new FileInputStream(file);
             final List<String> lines = IOUtils.readLines(in, "UTF-8");
@@ -759,16 +752,16 @@ public class IOUtilsTestCase extends Fil
             assertEquals(-1, in.read());
         } finally {
             IOUtils.closeQuietly(in);
-            deleteFile(file);
+            TestUtils.deleteFile(file);
         }
     }
 
-    public void testReadLines_Reader() throws Exception {
-        final File file = newFile("lines.txt");
+    @Test public void testReadLines_Reader() throws Exception {
+        final File file = TestUtils.newFile(getTestDirectory(), "lines.txt");
         Reader in = null;
         try {
             final String[] data = new String[] { "hello", "/u1234", "", "this 
is", "some text" };
-            createLineBasedFile(file, data);
+            TestUtils.createLineBasedFile(file, data);
 
             in = new InputStreamReader(new FileInputStream(file));
             final List<String> lines = IOUtils.readLines(in);
@@ -776,11 +769,11 @@ public class IOUtilsTestCase extends Fil
             assertEquals(-1, in.read());
         } finally {
             IOUtils.closeQuietly(in);
-            deleteFile(file);
+            TestUtils.deleteFile(file);
         }
     }
 
-    public void testSkip_FileReader() throws Exception {
+    @Test public void testSkip_FileReader() throws Exception {
         final FileReader in = new FileReader(m_testFile);
         try {
             assertEquals(FILE_SIZE - 10, IOUtils.skip(in, FILE_SIZE - 10));
@@ -791,7 +784,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testSkip_InputStream() throws Exception {
+    @Test public void testSkip_InputStream() throws Exception {
         final InputStream in = new FileInputStream(m_testFile);
         try {
             assertEquals(FILE_SIZE - 10, IOUtils.skip(in, FILE_SIZE - 10));
@@ -802,7 +795,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testSkip_ReadableByteChannel() throws Exception {
+    @Test public void testSkip_ReadableByteChannel() throws Exception {
         final FileInputStream fileInputStream = new 
FileInputStream(m_testFile);
         final FileChannel fileChannel = fileInputStream.getChannel();
         try {
@@ -814,7 +807,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testSkipFully_InputStream() throws Exception {
+    @Test public void testSkipFully_InputStream() throws Exception {
         final int size = 1027;
 
         final InputStream input = new ByteArrayInputStream(new byte[size]);
@@ -836,7 +829,7 @@ public class IOUtilsTestCase extends Fil
 
     }
 
-    public void testSkipFully_ReadableByteChannel() throws Exception {
+    @Test public void testSkipFully_ReadableByteChannel() throws Exception {
         final FileInputStream fileInputStream = new 
FileInputStream(m_testFile);
         final FileChannel fileChannel = fileInputStream.getChannel();
         try {
@@ -859,7 +852,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testSkipFully_Reader() throws Exception {
+    @Test public void testSkipFully_Reader() throws Exception {
         final int size = 1027;
 
         final Reader input = new CharArrayReader(new char[size]);
@@ -882,8 +875,8 @@ public class IOUtilsTestCase extends Fil
 
     @SuppressWarnings("deprecation")
     // testing deprecated method
-    public void testStringToOutputStream() throws Exception {
-        final File destination = newFile("copy5.txt");
+    @Test public void testStringToOutputStream() throws Exception {
+        final File destination = TestUtils.newFile(getTestDirectory(), 
"copy5.txt");
         final FileReader fin = new FileReader(m_testFile);
         String str;
         try {
@@ -903,15 +896,15 @@ public class IOUtilsTestCase extends Fil
             // out = fout;
             // note: we don't flush here; this IOUtils method does it for us
 
-            checkFile(destination, m_testFile);
-            checkWrite(fout);
+            TestUtils.checkFile(destination, m_testFile);
+            TestUtils.checkWrite(fout);
         } finally {
             fout.close();
         }
-        deleteFile(destination);
+        TestUtils.deleteFile(destination);
     }
 
-    public void testToBufferedInputStream_InputStream() throws Exception {
+    @Test public void testToBufferedInputStream_InputStream() throws Exception 
{
         final FileInputStream fin = new FileInputStream(m_testFile);
         try {
             final InputStream in = IOUtils.toBufferedInputStream(fin);
@@ -919,13 +912,13 @@ public class IOUtilsTestCase extends Fil
             assertNotNull(out);
             assertEquals("Not all bytes were read", 0, fin.available());
             assertEquals("Wrong output size", FILE_SIZE, out.length);
-            assertEqualContent(out, m_testFile);
+            TestUtils.assertEqualContent(out, m_testFile);
         } finally {
             fin.close();
         }
     }
 
-    public void testToBufferedInputStreamWithBufferSize_InputStream() throws 
Exception {
+    @Test public void testToBufferedInputStreamWithBufferSize_InputStream() 
throws Exception {
         final FileInputStream fin = new FileInputStream(m_testFile);
         try {
             final InputStream in = IOUtils.toBufferedInputStream(fin, 2048);
@@ -933,26 +926,26 @@ public class IOUtilsTestCase extends Fil
             assertNotNull(out);
             assertEquals("Not all bytes were read", 0, fin.available());
             assertEquals("Wrong output size", FILE_SIZE, out.length);
-            assertEqualContent(out, m_testFile);
+            TestUtils.assertEqualContent(out, m_testFile);
         } finally {
             fin.close();
         }
     }
 
-    public void testToByteArray_InputStream() throws Exception {
+    @Test public void testToByteArray_InputStream() throws Exception {
         final FileInputStream fin = new FileInputStream(m_testFile);
         try {
             final byte[] out = IOUtils.toByteArray(fin);
             assertNotNull(out);
             assertEquals("Not all bytes were read", 0, fin.available());
             assertEquals("Wrong output size", FILE_SIZE, out.length);
-            assertEqualContent(out, m_testFile);
+            TestUtils.assertEqualContent(out, m_testFile);
         } finally {
             fin.close();
         }
     }
 
-    public void testToByteArray_InputStream_NegativeSize() throws Exception {
+    @Test public void testToByteArray_InputStream_NegativeSize() throws 
Exception {
         final FileInputStream fin = new FileInputStream(m_testFile);
 
         try {
@@ -967,20 +960,20 @@ public class IOUtilsTestCase extends Fil
 
     }
 
-    public void testToByteArray_InputStream_Size() throws Exception {
+    @Test public void testToByteArray_InputStream_Size() throws Exception {
         final FileInputStream fin = new FileInputStream(m_testFile);
         try {
             final byte[] out = IOUtils.toByteArray(fin, m_testFile.length());
             assertNotNull(out);
             assertEquals("Not all bytes were read", 0, fin.available());
             assertEquals("Wrong output size: out.length=" + out.length + "!=" 
+ FILE_SIZE, FILE_SIZE, out.length);
-            assertEqualContent(out, m_testFile);
+            TestUtils.assertEqualContent(out, m_testFile);
         } finally {
             fin.close();
         }
     }
 
-    public void testToByteArray_InputStream_SizeIllegal() throws Exception {
+    @Test public void testToByteArray_InputStream_SizeIllegal() throws 
Exception {
         final FileInputStream fin = new FileInputStream(m_testFile);
 
         try {
@@ -995,7 +988,7 @@ public class IOUtilsTestCase extends Fil
 
     }
 
-    public void testToByteArray_InputStream_SizeLong() throws Exception {
+    @Test public void testToByteArray_InputStream_SizeLong() throws Exception {
         final FileInputStream fin = new FileInputStream(m_testFile);
 
         try {
@@ -1010,7 +1003,7 @@ public class IOUtilsTestCase extends Fil
 
     }
 
-    public void testToByteArray_InputStream_SizeZero() throws Exception {
+    @Test public void testToByteArray_InputStream_SizeZero() throws Exception {
         final FileInputStream fin = new FileInputStream(m_testFile);
 
         try {
@@ -1023,7 +1016,7 @@ public class IOUtilsTestCase extends Fil
     }
 
     @SuppressWarnings("deprecation") // deliberately testing deprecated method
-    public void testToByteArray_Reader() throws IOException {
+    @Test public void testToByteArray_Reader() throws IOException {
         final String charsetName = "UTF-8";
         final byte[] expecteds = charsetName.getBytes(charsetName);
         byte[] actuals = IOUtils.toByteArray(new InputStreamReader(new 
ByteArrayInputStream(expecteds)));
@@ -1034,7 +1027,7 @@ public class IOUtilsTestCase extends Fil
 
     @SuppressWarnings("deprecation")
     // testing deprecated method
-    public void testToByteArray_String() throws Exception {
+    @Test public void testToByteArray_String() throws Exception {
         final FileReader fin = new FileReader(m_testFile);
         try {
             // Create our String. Rely on testReaderToString() to make sure 
this is valid.
@@ -1047,19 +1040,19 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testToByteArray_URI() throws Exception {
+    @Test public void testToByteArray_URI() throws Exception {
         final URI url = m_testFile.toURI();
         final byte[] actual = IOUtils.toByteArray(url);
-        Assert.assertEquals(FILE_SIZE, actual.length);
+        assertEquals(FILE_SIZE, actual.length);
     }
 
-    public void testToByteArray_URL() throws Exception {
+    @Test public void testToByteArray_URL() throws Exception {
         final URL url = m_testFile.toURI().toURL();
         final byte[] actual = IOUtils.toByteArray(url);
-        Assert.assertEquals(FILE_SIZE, actual.length);
+        assertEquals(FILE_SIZE, actual.length);
     }
 
-    public void testToByteArray_URLConnection() throws Exception {
+    @Test public void testToByteArray_URLConnection() throws Exception {
         final URLConnection urlConn = 
m_testFile.toURI().toURL().openConnection();
         byte[] actual;
         try {
@@ -1067,43 +1060,43 @@ public class IOUtilsTestCase extends Fil
         } finally {
             IOUtils.close(urlConn);
         }
-        Assert.assertEquals(FILE_SIZE, actual.length);
+        assertEquals(FILE_SIZE, actual.length);
     }
 
     @SuppressWarnings("deprecation") // deliberately testing deprecated method
-    public void testToCharArray_InputStream() throws Exception {
+    @Test public void testToCharArray_InputStream() throws Exception {
         final FileInputStream fin = new FileInputStream(m_testFile);
         try {
             final char[] out = IOUtils.toCharArray(fin);
             assertNotNull(out);
             assertEquals("Not all chars were read", 0, fin.available());
             assertEquals("Wrong output size", FILE_SIZE, out.length);
-            assertEqualContent(out, m_testFile);
+            TestUtils.assertEqualContent(out, m_testFile);
         } finally {
             fin.close();
         }
     }
 
-    public void testToCharArray_InputStream_CharsetName() throws Exception {
+    @Test public void testToCharArray_InputStream_CharsetName() throws 
Exception {
         final FileInputStream fin = new FileInputStream(m_testFile);
         try {
             final char[] out = IOUtils.toCharArray(fin, "UTF-8");
             assertNotNull(out);
             assertEquals("Not all chars were read", 0, fin.available());
             assertEquals("Wrong output size", FILE_SIZE, out.length);
-            assertEqualContent(out, m_testFile);
+            TestUtils.assertEqualContent(out, m_testFile);
         } finally {
             fin.close();
         }
     }
 
-    public void testToCharArray_Reader() throws Exception {
+    @Test public void testToCharArray_Reader() throws Exception {
         final FileReader fr = new FileReader(m_testFile);
         try {
             final char[] out = IOUtils.toCharArray(fr);
             assertNotNull(out);
             assertEquals("Wrong output size", FILE_SIZE, out.length);
-            assertEqualContent(out, m_testFile);
+            TestUtils.assertEqualContent(out, m_testFile);
         } finally {
             fr.close();
         }
@@ -1118,7 +1111,7 @@ public class IOUtilsTestCase extends Fil
      *             on error
      */
     @SuppressWarnings("javadoc") // deliberately testing deprecated method
-    public void testToInputStream_CharSequence() throws Exception {
+    @Test public void testToInputStream_CharSequence() throws Exception {
         final CharSequence csq = new StringBuilder("Abc123Xyz!");
         @SuppressWarnings("deprecation")
         InputStream inStream = IOUtils.toInputStream(csq); // deliberately 
testing deprecated method
@@ -1143,7 +1136,7 @@ public class IOUtilsTestCase extends Fil
      *             on error
      */
     @SuppressWarnings("javadoc") // deliberately testing deprecated method
-    public void testToInputStream_String() throws Exception {
+    @Test public void testToInputStream_String() throws Exception {
         final String str = "Abc123Xyz!";
         @SuppressWarnings("deprecation") // deliberately testing deprecated 
method
         InputStream inStream = IOUtils.toInputStream(str);
@@ -1159,7 +1152,7 @@ public class IOUtilsTestCase extends Fil
 
     @SuppressWarnings("deprecation")
     // testing deprecated method
-    public void testToString_ByteArray() throws Exception {
+    @Test public void testToString_ByteArray() throws Exception {
         final FileInputStream fin = new FileInputStream(m_testFile);
         try {
             final byte[] in = IOUtils.toByteArray(fin);
@@ -1172,7 +1165,7 @@ public class IOUtilsTestCase extends Fil
     }
 
     @SuppressWarnings("deprecation") // deliberately testing deprecated method
-    public void testToString_InputStream() throws Exception {
+    @Test public void testToString_InputStream() throws Exception {
         final FileInputStream fin = new FileInputStream(m_testFile);
         try {
             final String out = IOUtils.toString(fin);
@@ -1184,7 +1177,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testToString_Reader() throws Exception {
+    @Test public void testToString_Reader() throws Exception {
         final FileReader fin = new FileReader(m_testFile);
         try {
             final String out = IOUtils.toString(fin);
@@ -1196,7 +1189,7 @@ public class IOUtilsTestCase extends Fil
     }
 
     @SuppressWarnings("deprecation") // deliberately testing deprecated method
-    public void testToString_URI() throws Exception {
+    @Test public void testToString_URI() throws Exception {
         final URI url = m_testFile.toURI();
         final String out = IOUtils.toString(url);
         assertNotNull(out);
@@ -1210,16 +1203,16 @@ public class IOUtilsTestCase extends Fil
         assertEquals("Wrong output size", FILE_SIZE, out.length());
     }
 
-    public void testToString_URI_CharsetName() throws Exception {
+    @Test public void testToString_URI_CharsetName() throws Exception {
         testToString_URI("US-ASCII");
     }
 
-    public void testToString_URI_CharsetNameNull() throws Exception {
+    @Test public void testToString_URI_CharsetNameNull() throws Exception {
         testToString_URI(null);
     }
 
     @SuppressWarnings("deprecation") // deliberately testing deprecated method
-    public void testToString_URL() throws Exception {
+    @Test public void testToString_URL() throws Exception {
         final URL url = m_testFile.toURI().toURL();
         final String out = IOUtils.toString(url);
         assertNotNull(out);
@@ -1233,15 +1226,15 @@ public class IOUtilsTestCase extends Fil
         assertEquals("Wrong output size", FILE_SIZE, out.length());
     }
 
-    public void testToString_URL_CharsetName() throws Exception {
+    @Test public void testToString_URL_CharsetName() throws Exception {
         testToString_URL("US-ASCII");
     }
 
-    public void testToString_URL_CharsetNameNull() throws Exception {
+    @Test public void testToString_URL_CharsetNameNull() throws Exception {
         testToString_URL(null);
     }
 
-    public void testAsBufferedNull() {
+    @Test public void testAsBufferedNull() {
         try {
             IOUtils.buffer((InputStream) null);
             fail("Expected NullPointerException");
@@ -1268,7 +1261,7 @@ public class IOUtilsTestCase extends Fil
         }
     }
 
-    public void testAsBufferedInputStream() {
+    @Test public void testAsBufferedInputStream() {
         InputStream is = new InputStream() {
             @Override
             public int read() throws IOException {
@@ -1280,7 +1273,7 @@ public class IOUtilsTestCase extends Fil
         assertSame(bis, IOUtils.buffer(bis));
     }
 
-    public void testAsBufferedInputStreamWithBufferSize() {
+    @Test public void testAsBufferedInputStreamWithBufferSize() {
         InputStream is = new InputStream() {
             @Override
             public int read() throws IOException {
@@ -1293,7 +1286,7 @@ public class IOUtilsTestCase extends Fil
         assertSame(bis, IOUtils.buffer(bis, 1024));
     }
 
-    public void testAsBufferedOutputStream() {
+    @Test public void testAsBufferedOutputStream() {
         OutputStream is = new OutputStream() {
             @Override
             public void write(int b) throws IOException { }
@@ -1303,7 +1296,7 @@ public class IOUtilsTestCase extends Fil
         assertSame(bis, IOUtils.buffer(bis));
     }
 
-    public void testAsBufferedOutputStreamWithBufferSize() {
+    @Test public void testAsBufferedOutputStreamWithBufferSize() {
         OutputStream os = new OutputStream() {
             @Override
             public void write(int b) throws IOException { }
@@ -1314,7 +1307,7 @@ public class IOUtilsTestCase extends Fil
         assertSame(bos, IOUtils.buffer(bos, 1024));
     }
 
-    public void testAsBufferedReader() {
+    @Test public void testAsBufferedReader() {
         Reader is = new Reader() {
             @Override
             public int read(char[] cbuf, int off, int len) throws IOException {
@@ -1328,7 +1321,7 @@ public class IOUtilsTestCase extends Fil
         assertSame(bis, IOUtils.buffer(bis));
     }
 
-    public void testAsBufferedReaderWithBufferSize() {
+    @Test public void testAsBufferedReaderWithBufferSize() {
         Reader r = new Reader() {
             @Override
             public int read(char[] cbuf, int off, int len) throws IOException {
@@ -1343,7 +1336,7 @@ public class IOUtilsTestCase extends Fil
         assertSame(br, IOUtils.buffer(br, 1024));
     }
 
-    public void testAsBufferedWriter() {
+    @Test public void testAsBufferedWriter() {
         Writer is = new Writer() {
             @Override
             public void write(int b) throws IOException { }
@@ -1362,6 +1355,7 @@ public class IOUtilsTestCase extends Fil
         assertSame(bis, IOUtils.buffer(bis));
     }
 
+    @Test
     public void testAsBufferedWriterWithBufferSize() {
         Writer w = new Writer() {
             @Override

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsWriteTestCase.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsWriteTestCase.java?rev=1718944&r1=1718943&r2=1718944&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsWriteTestCase.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsWriteTestCase.java
 Wed Dec  9 19:50:30 2015
@@ -16,15 +16,21 @@
  */
 package org.apache.commons.io;
 
+import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.commons.io.testtools.FileBasedTestCase;
+import org.apache.commons.io.testtools.TestUtils;
+import org.apache.commons.io.testtools.YellOnFlushAndCloseOutputStream;
+import org.junit.Test;
+
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.io.output.ByteArrayOutputStream;
-import org.apache.commons.io.testtools.FileBasedTestCase;
-import org.apache.commons.io.testtools.YellOnFlushAndCloseOutputStream;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
  * JUnit tests for IOUtils write methods.
@@ -38,29 +44,14 @@ public class IOUtilsWriteTestCase extend
     private static final int FILE_SIZE = 1024 * 4 + 1;
 
 
-    private final byte[] inData = generateTestData(FILE_SIZE);
-
-    public IOUtilsWriteTestCase(final String testName) {
-        super(testName);
-    }
-
-    // ----------------------------------------------------------------
-    // Setup
-    // ----------------------------------------------------------------
-
-    @Override
-    public void setUp() throws Exception {
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-    }
+    private final byte[] inData = TestUtils.generateTestData((long) FILE_SIZE);
 
     // ----------------------------------------------------------------
     // Tests
     // ----------------------------------------------------------------
 
     //-----------------------------------------------------------------------
+    @Test
     public void testWrite_byteArrayToOutputStream() throws Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         final YellOnFlushAndCloseOutputStream out = new 
YellOnFlushAndCloseOutputStream(baout, true, true);
@@ -73,6 +64,7 @@ public class IOUtilsWriteTestCase extend
         assertTrue("Content differs", Arrays.equals(inData, 
baout.toByteArray()));
     }
 
+    @Test
     public void testWrite_byteArrayToOutputStream_nullData() throws Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         final YellOnFlushAndCloseOutputStream out = new 
YellOnFlushAndCloseOutputStream(baout, true, true);
@@ -84,14 +76,17 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWrite_byteArrayToOutputStream_nullStream() throws 
Exception {
         try {
             IOUtils.write(inData, (OutputStream) null);
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
 
     //-----------------------------------------------------------------------
+    @Test
     public void testWrite_byteArrayToWriter() throws Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         @SuppressWarnings("resource") // deliberately not closed
@@ -106,6 +101,7 @@ public class IOUtilsWriteTestCase extend
         assertTrue("Content differs", Arrays.equals(inData, 
baout.toByteArray()));
     }
 
+    @Test
     public void testWrite_byteArrayToWriter_nullData() throws Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         @SuppressWarnings("resource") // deliberately not closed
@@ -119,14 +115,17 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWrite_byteArrayToWriter_nullWriter() throws Exception {
         try {
             IOUtils.write(inData, (Writer) null);
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
 
     //-----------------------------------------------------------------------
+    @Test
     public void testWrite_byteArrayToWriter_Encoding() throws Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         @SuppressWarnings("resource") // deliberately not closed
@@ -142,6 +141,7 @@ public class IOUtilsWriteTestCase extend
         assertTrue("Content differs", Arrays.equals(inData, bytes));
     }
 
+    @Test
     public void testWrite_byteArrayToWriter_Encoding_nullData() throws 
Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         @SuppressWarnings("resource") // deliberately not closed
@@ -155,13 +155,16 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWrite_byteArrayToWriter_Encoding_nullWriter() throws 
Exception {
         try {
             IOUtils.write(inData, null, "UTF8");
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
 
+    @Test
     public void testWrite_byteArrayToWriter_Encoding_nullEncoding() throws 
Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         @SuppressWarnings("resource") // deliberately not closed
@@ -175,7 +178,9 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", inData.length, baout.size());
         assertTrue("Content differs", Arrays.equals(inData, 
baout.toByteArray()));
     }
+
     //-----------------------------------------------------------------------
+    @Test
     public void testWrite_charSequenceToOutputStream() throws Exception {
         final CharSequence csq = new StringBuilder(new String(inData, 
"US-ASCII"));
 
@@ -190,6 +195,7 @@ public class IOUtilsWriteTestCase extend
         assertTrue("Content differs", Arrays.equals(inData, 
baout.toByteArray()));
     }
 
+    @Test
     public void testWrite_charSequenceToOutputStream_nullData() throws 
Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         final YellOnFlushAndCloseOutputStream out = new 
YellOnFlushAndCloseOutputStream(baout, true, true);
@@ -201,15 +207,18 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWrite_charSequenceToOutputStream_nullStream() throws 
Exception {
         final CharSequence csq = new StringBuilder(new String(inData, 
"US-ASCII"));
         try {
             IOUtils.write(csq, (OutputStream) null);
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
 
     //-----------------------------------------------------------------------
+    @Test
     public void testWrite_charSequenceToOutputStream_Encoding() throws 
Exception {
         final CharSequence csq = new StringBuilder(new String(inData, 
"US-ASCII"));
 
@@ -225,6 +234,7 @@ public class IOUtilsWriteTestCase extend
         assertTrue("Content differs", Arrays.equals(inData, bytes));
     }
 
+    @Test
     public void testWrite_charSequenceToOutputStream_Encoding_nullData() 
throws Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         final YellOnFlushAndCloseOutputStream out = new 
YellOnFlushAndCloseOutputStream(baout, true, true);
@@ -236,14 +246,17 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWrite_charSequenceToOutputStream_Encoding_nullStream() 
throws Exception {
         final CharSequence csq = new StringBuilder(new String(inData, 
"US-ASCII"));
         try {
             IOUtils.write(csq, (OutputStream) null);
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
 
+    @Test
     public void testWrite_charSequenceToOutputStream_nullEncoding() throws 
Exception {
         final CharSequence csq = new StringBuilder(new String(inData, 
"US-ASCII"));
 
@@ -259,6 +272,7 @@ public class IOUtilsWriteTestCase extend
     }
 
     //-----------------------------------------------------------------------
+    @Test
     public void testWrite_charSequenceToWriter() throws Exception {
         final CharSequence csq = new StringBuilder(new String(inData, 
"US-ASCII"));
 
@@ -275,6 +289,7 @@ public class IOUtilsWriteTestCase extend
         assertTrue("Content differs", Arrays.equals(inData, 
baout.toByteArray()));
     }
 
+    @Test
     public void testWrite_charSequenceToWriter_Encoding_nullData() throws 
Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         @SuppressWarnings("resource") // deliberately not closed
@@ -288,14 +303,18 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWrite_charSequenceToWriter_Encoding_nullStream() throws 
Exception {
         final CharSequence csq = new StringBuilder(new String(inData, 
"US-ASCII"));
         try {
             IOUtils.write(csq, (Writer) null);
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
+
     //-----------------------------------------------------------------------
+    @Test
     public void testWrite_stringToOutputStream() throws Exception {
         final String str = new String(inData, "US-ASCII");
 
@@ -310,6 +329,7 @@ public class IOUtilsWriteTestCase extend
         assertTrue("Content differs", Arrays.equals(inData, 
baout.toByteArray()));
     }
 
+    @Test
     public void testWrite_stringToOutputStream_nullData() throws Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         final YellOnFlushAndCloseOutputStream out = new 
YellOnFlushAndCloseOutputStream(baout, true, true);
@@ -321,15 +341,18 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWrite_stringToOutputStream_nullStream() throws Exception {
         final String str = new String(inData, "US-ASCII");
         try {
             IOUtils.write(str, (OutputStream) null);
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
 
     //-----------------------------------------------------------------------
+    @Test
     public void testWrite_stringToOutputStream_Encoding() throws Exception {
         final String str = new String(inData, "US-ASCII");
 
@@ -345,6 +368,7 @@ public class IOUtilsWriteTestCase extend
         assertTrue("Content differs", Arrays.equals(inData, bytes));
     }
 
+    @Test
     public void testWrite_stringToOutputStream_Encoding_nullData() throws 
Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         final YellOnFlushAndCloseOutputStream out = new 
YellOnFlushAndCloseOutputStream(baout, true, true);
@@ -356,14 +380,17 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWrite_stringToOutputStream_Encoding_nullStream() throws 
Exception {
         final String str = new String(inData, "US-ASCII");
         try {
             IOUtils.write(str, (OutputStream) null);
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
 
+    @Test
     public void testWrite_stringToOutputStream_nullEncoding() throws Exception 
{
         final String str = new String(inData, "US-ASCII");
 
@@ -379,6 +406,7 @@ public class IOUtilsWriteTestCase extend
     }
 
     //-----------------------------------------------------------------------
+    @Test
     public void testWrite_stringToWriter() throws Exception {
         final String str = new String(inData, "US-ASCII");
 
@@ -395,6 +423,7 @@ public class IOUtilsWriteTestCase extend
         assertTrue("Content differs", Arrays.equals(inData, 
baout.toByteArray()));
     }
 
+    @Test
     public void testWrite_stringToWriter_Encoding_nullData() throws Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         @SuppressWarnings("resource") // deliberately not closed
@@ -408,15 +437,18 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWrite_stringToWriter_Encoding_nullStream() throws 
Exception {
         final String str = new String(inData, "US-ASCII");
         try {
             IOUtils.write(str, (Writer) null);
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
 
     //-----------------------------------------------------------------------
+    @Test
     public void testWrite_charArrayToOutputStream() throws Exception {
         final String str = new String(inData, "US-ASCII");
 
@@ -431,6 +463,7 @@ public class IOUtilsWriteTestCase extend
         assertTrue("Content differs", Arrays.equals(inData, 
baout.toByteArray()));
     }
 
+    @Test
     public void testWrite_charArrayToOutputStream_nullData() throws Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         final YellOnFlushAndCloseOutputStream out = new 
YellOnFlushAndCloseOutputStream(baout, true, true);
@@ -442,15 +475,18 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWrite_charArrayToOutputStream_nullStream() throws 
Exception {
         final String str = new String(inData, "US-ASCII");
         try {
             IOUtils.write(str.toCharArray(), (OutputStream) null);
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
 
     //-----------------------------------------------------------------------
+    @Test
     public void testWrite_charArrayToOutputStream_Encoding() throws Exception {
         final String str = new String(inData, "US-ASCII");
 
@@ -466,6 +502,7 @@ public class IOUtilsWriteTestCase extend
         assertTrue("Content differs", Arrays.equals(inData, bytes));
     }
 
+    @Test
     public void testWrite_charArrayToOutputStream_Encoding_nullData() throws 
Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         final YellOnFlushAndCloseOutputStream out = new 
YellOnFlushAndCloseOutputStream(baout, true, true);
@@ -477,14 +514,17 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWrite_charArrayToOutputStream_Encoding_nullStream() throws 
Exception {
         final String str = new String(inData, "US-ASCII");
         try {
             IOUtils.write(str.toCharArray(), (OutputStream) null);
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
 
+    @Test
     public void testWrite_charArrayToOutputStream_nullEncoding() throws 
Exception {
         final String str = new String(inData, "US-ASCII");
 
@@ -500,6 +540,7 @@ public class IOUtilsWriteTestCase extend
     }
 
     //-----------------------------------------------------------------------
+    @Test
     public void testWrite_charArrayToWriter() throws Exception {
         final String str = new String(inData, "US-ASCII");
 
@@ -516,6 +557,7 @@ public class IOUtilsWriteTestCase extend
         assertTrue("Content differs", Arrays.equals(inData, 
baout.toByteArray()));
     }
 
+    @Test
     public void testWrite_charArrayToWriter_Encoding_nullData() throws 
Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         @SuppressWarnings("resource") // deliberately not closed
@@ -529,18 +571,21 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWrite_charArrayToWriter_Encoding_nullStream() throws 
Exception {
         final String str = new String(inData, "US-ASCII");
         try {
             IOUtils.write(str.toCharArray(), (Writer) null);
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
 
     //-----------------------------------------------------------------------
+    @Test
     public void testWriteLines_OutputStream() throws Exception {
-        final Object[] data = new Object[] {
-            "hello", new StringBuffer("world"), "", "this is", null, "some 
text"};
+        final Object[] data = new Object[]{
+                "hello", new StringBuffer("world"), "", "this is", null, "some 
text"};
         final List<Object> list = Arrays.asList(data);
 
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
@@ -556,6 +601,7 @@ public class IOUtilsWriteTestCase extend
         assertEquals(expected, actual);
     }
 
+    @Test
     public void testWriteLines_OutputStream_nullData() throws Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         final YellOnFlushAndCloseOutputStream out = new 
YellOnFlushAndCloseOutputStream(baout, false, true);
@@ -567,8 +613,9 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWriteLines_OutputStream_nullSeparator() throws Exception {
-        final Object[] data = new Object[] {"hello", "world"};
+        final Object[] data = new Object[]{"hello", "world"};
         final List<Object> list = Arrays.asList(data);
 
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
@@ -583,19 +630,22 @@ public class IOUtilsWriteTestCase extend
         assertEquals(expected, actual);
     }
 
+    @Test
     public void testWriteLines_OutputStream_nullStream() throws Exception {
-        final Object[] data = new Object[] {"hello", "world"};
+        final Object[] data = new Object[]{"hello", "world"};
         final List<Object> list = Arrays.asList(data);
         try {
             IOUtils.writeLines(list, "*", (OutputStream) null);
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
 
     //-----------------------------------------------------------------------
+    @Test
     public void testWriteLines_OutputStream_Encoding() throws Exception {
-        final Object[] data = new Object[] {
-            "hello\u8364", new StringBuffer("world"), "", "this is", null, 
"some text"};
+        final Object[] data = new Object[]{
+                "hello\u8364", new StringBuffer("world"), "", "this is", null, 
"some text"};
         final List<Object> list = Arrays.asList(data);
 
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
@@ -611,6 +661,7 @@ public class IOUtilsWriteTestCase extend
         assertEquals(expected, actual);
     }
 
+    @Test
     public void testWriteLines_OutputStream_Encoding_nullData() throws 
Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         final YellOnFlushAndCloseOutputStream out = new 
YellOnFlushAndCloseOutputStream(baout, false, true);
@@ -622,8 +673,9 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWriteLines_OutputStream_Encoding_nullSeparator() throws 
Exception {
-        final Object[] data = new Object[] {"hello", "world"};
+        final Object[] data = new Object[]{"hello", "world"};
         final List<Object> list = Arrays.asList(data);
 
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
@@ -638,18 +690,21 @@ public class IOUtilsWriteTestCase extend
         assertEquals(expected, actual);
     }
 
+    @Test
     public void testWriteLines_OutputStream_Encoding_nullStream() throws 
Exception {
-        final Object[] data = new Object[] {"hello", "world"};
+        final Object[] data = new Object[]{"hello", "world"};
         final List<Object> list = Arrays.asList(data);
         try {
             IOUtils.writeLines(list, "*", null, "US-ASCII");
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
 
+    @Test
     public void testWriteLines_OutputStream_Encoding_nullEncoding() throws 
Exception {
-        final Object[] data = new Object[] {
-            "hello", new StringBuffer("world"), "", "this is", null, "some 
text"};
+        final Object[] data = new Object[]{
+                "hello", new StringBuffer("world"), "", "this is", null, "some 
text"};
         final List<Object> list = Arrays.asList(data);
 
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
@@ -666,9 +721,10 @@ public class IOUtilsWriteTestCase extend
     }
 
     //-----------------------------------------------------------------------
+    @Test
     public void testWriteLines_Writer() throws Exception {
-        final Object[] data = new Object[] {
-            "hello", new StringBuffer("world"), "", "this is", null, "some 
text"};
+        final Object[] data = new Object[]{
+                "hello", new StringBuffer("world"), "", "this is", null, "some 
text"};
         final List<Object> list = Arrays.asList(data);
 
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
@@ -686,6 +742,7 @@ public class IOUtilsWriteTestCase extend
         assertEquals(expected, actual);
     }
 
+    @Test
     public void testWriteLines_Writer_nullData() throws Exception {
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
         @SuppressWarnings("resource") // deliberately not closed
@@ -699,8 +756,9 @@ public class IOUtilsWriteTestCase extend
         assertEquals("Sizes differ", 0, baout.size());
     }
 
+    @Test
     public void testWriteLines_Writer_nullSeparator() throws Exception {
-        final Object[] data = new Object[] {"hello", "world"};
+        final Object[] data = new Object[]{"hello", "world"};
         final List<Object> list = Arrays.asList(data);
 
         final ByteArrayOutputStream baout = new ByteArrayOutputStream();
@@ -717,13 +775,15 @@ public class IOUtilsWriteTestCase extend
         assertEquals(expected, actual);
     }
 
+    @Test
     public void testWriteLines_Writer_nullStream() throws Exception {
-        final Object[] data = new Object[] {"hello", "world"};
+        final Object[] data = new Object[]{"hello", "world"};
         final List<Object> list = Arrays.asList(data);
         try {
             IOUtils.writeLines(list, "*", (Writer) null);
             fail();
-        } catch (final NullPointerException ex) {}
+        } catch (final NullPointerException ignore) {
+        }
     }
 
 }

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java?rev=1718944&r1=1718943&r2=1718944&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java
 Wed Dec  9 19:50:30 2015
@@ -33,6 +33,12 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 /**
  * This is used to test LineIterator for correctness.
  *
@@ -40,10 +46,6 @@ import org.junit.Test;
  */
 public class LineIteratorTestCase extends FileBasedTestCase {
 
-    public LineIteratorTestCase(final String name) {
-        super(name);
-    }
-
     private void assertLines(final List<String> lines, final LineIterator 
iterator) {
         try {
             for (int i = 0; i < lines.size(); i++) {
@@ -99,9 +101,8 @@ public class LineIteratorTestCase extend
         return lines;
     }
 
-    @Override
     @Before
-    protected void setUp() throws Exception {
+    public void setUp() throws Exception {
         final File dir = getTestDirectory();
         if (dir.exists()) {
             FileUtils.deleteDirectory(dir);
@@ -110,9 +111,8 @@ public class LineIteratorTestCase extend
 
     }
 
-    @Override
     @After
-    protected void tearDown() throws Exception {
+    public void tearDown() throws Exception {
         FileUtils.deleteDirectory(getTestDirectory());
     }
 

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/TaggedIOExceptionTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/TaggedIOExceptionTest.java?rev=1718944&r1=1718943&r2=1718944&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/TaggedIOExceptionTest.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/TaggedIOExceptionTest.java
 Wed Dec  9 19:50:30 2015
@@ -21,12 +21,18 @@ import java.io.Serializable;
 import java.util.UUID;
 
 import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 /**
  * JUnit Test Case for {@link TaggedIOException}.
  */
-public class TaggedIOExceptionTest extends TestCase {
+public class TaggedIOExceptionTest {
 
+    @Test
     public void testTaggedIOException() {
         final Serializable tag = UUID.randomUUID();
         final IOException exception = new IOException("Test exception");

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/ThreadMonitorTestCase.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/ThreadMonitorTestCase.java?rev=1718944&r1=1718943&r2=1718944&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/ThreadMonitorTestCase.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/ThreadMonitorTestCase.java
 Wed Dec  9 19:50:30 2015
@@ -16,21 +16,20 @@
  */
 package org.apache.commons.io;
 
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
 
 /**
  * Tests for {@link ThreadMonitor}.
  */
-public class ThreadMonitorTestCase extends TestCase {
-
-
-    public ThreadMonitorTestCase(final String name) {
-        super(name);
-    }
+public class ThreadMonitorTestCase {
 
     /**
      * Test timeout.
      */
+    @Test
     public void testTimeout() {
         try {
             final Thread monitor = ThreadMonitor.start(100);
@@ -45,6 +44,7 @@ public class ThreadMonitorTestCase exten
     /**
      * Test task completed before timeout.
      */
+    @Test
     public void testCompletedWithoutTimeout() {
         try {
             final Thread monitor = ThreadMonitor.start(200);
@@ -58,6 +58,7 @@ public class ThreadMonitorTestCase exten
     /**
      * Test No timeout.
      */
+    @Test
     public void testNoTimeout() {
 
         // timeout = -1

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/ComparatorAbstractTestCase.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/ComparatorAbstractTestCase.java?rev=1718944&r1=1718943&r2=1718944&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/ComparatorAbstractTestCase.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/ComparatorAbstractTestCase.java
 Wed Dec  9 19:50:30 2015
@@ -23,6 +23,15 @@ import java.util.List;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.testtools.FileBasedTestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Base Test case for Comparator implementations.
@@ -47,24 +56,9 @@ public abstract class ComparatorAbstract
     /** File which is more than the "lessFile" */
     protected File moreFile;
 
-    /**
-     * Construct a new test case with the specified name
-     * @param name Name of the test
-     */
-    public ComparatorAbstractTestCase(final String name) {
-        super(name);
-    }
-
-    /** @see junit.framework.TestCase#setUp() */
-    @Override
-    protected void setUp() throws Exception {
-        comparator = (AbstractFileComparator) 
DefaultFileComparator.DEFAULT_COMPARATOR;
-        reverse = DefaultFileComparator.DEFAULT_REVERSE;
-    }
-
     /** @see junit.framework.TestCase#tearDown() */
-    @Override
-    protected void tearDown() throws Exception {
+    @After
+    public void tearDown() throws Exception {
         comparator = null;
         reverse = null;
         equalFile1 = null;
@@ -77,6 +71,7 @@ public abstract class ComparatorAbstract
     /**
      * Test the comparator.
      */
+    @Test
     public void testComparator() {
         assertEquals("equal", 0, comparator.compare(equalFile1, equalFile2));
         assertTrue("less",  comparator.compare(lessFile, moreFile) < 0);
@@ -86,6 +81,7 @@ public abstract class ComparatorAbstract
     /**
      * Test the comparator reversed.
      */
+    @Test
     public void testReverseComparator() {
         assertEquals("equal", 0, reverse.compare(equalFile1, equalFile2));
         assertTrue("less",  reverse.compare(moreFile, lessFile) < 0);
@@ -95,6 +91,7 @@ public abstract class ComparatorAbstract
     /**
      * Test comparator array sort is null safe.
      */
+    @Test
     public void testSortArrayNull() {
         assertNull(comparator.sort((File[])null));
     }
@@ -102,6 +99,7 @@ public abstract class ComparatorAbstract
     /**
      * Test the comparator array sort.
      */
+    @Test
     public void testSortArray() {
         final File[] files = new File[3];
         files[0] = equalFile1;
@@ -116,6 +114,7 @@ public abstract class ComparatorAbstract
     /**
      * Test the comparator array sort.
      */
+    @Test
     public void testSortList() {
         final List<File> files = new ArrayList<File>();
         files.add(equalFile1);
@@ -130,6 +129,7 @@ public abstract class ComparatorAbstract
     /**
      * Test comparator list sort is null safe.
      */
+    @Test
     public void testSortListNull() {
         assertNull(comparator.sort((List<File>)null));
     }
@@ -137,6 +137,7 @@ public abstract class ComparatorAbstract
     /**
      * Test comparator toString.
      */
+    @Test
     public void testToString() {
         assertNotNull("comparator", comparator.toString());
         assertTrue("reverse", 
reverse.toString().startsWith("ReverseComparator["));

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/CompositeFileComparatorTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/CompositeFileComparatorTest.java?rev=1718944&r1=1718943&r2=1718944&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/CompositeFileComparatorTest.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/CompositeFileComparatorTest.java
 Wed Dec  9 19:50:30 2015
@@ -16,29 +16,29 @@
  */
 package org.apache.commons.io.comparator;
 
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.testtools.TestUtils;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.BufferedOutputStream;
 import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 /**
  * Test case for {@link CompositeFileComparator}.
  */
 public class CompositeFileComparatorTest extends ComparatorAbstractTestCase {
 
-    /**
-     * Construct a new test case with the specified name.
-     *
-     * @param name Name of the test
-     */
-    public CompositeFileComparatorTest(final String name) {
-        super(name);
-    }
-
-    /** @see junit.framework.TestCase#setUp() */
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         comparator = new CompositeFileComparator(
                 new AbstractFileComparator[] {
                     (AbstractFileComparator) 
SizeFileComparator.SIZE_COMPARATOR,
@@ -49,16 +49,57 @@ public class CompositeFileComparatorTest
         equalFile1 = new File(dir, "foo.txt");
         equalFile2 = new File(dir, "bar.txt");
         moreFile   = new File(dir, "foo.xyz");
-        createFile(lessFile,   32);
-        createFile(equalFile1, 48);
-        createFile(equalFile2, 48);
-        createFile(moreFile,   48);
+        if (!lessFile.getParentFile().exists()) {
+            throw new IOException("Cannot create file " + lessFile
+                    + " as the parent directory does not exist");
+        }
+        final BufferedOutputStream output3 =
+                new BufferedOutputStream(new FileOutputStream(lessFile));
+        try {
+            TestUtils.generateTestData(output3, (long) 32);
+        } finally {
+            IOUtils.closeQuietly(output3);
+        }
+        if (!equalFile1.getParentFile().exists()) {
+            throw new IOException("Cannot create file " + equalFile1
+                    + " as the parent directory does not exist");
+        }
+        final BufferedOutputStream output2 =
+                new BufferedOutputStream(new FileOutputStream(equalFile1));
+        try {
+            TestUtils.generateTestData(output2, (long) 48);
+        } finally {
+            IOUtils.closeQuietly(output2);
+        }
+        if (!equalFile2.getParentFile().exists()) {
+            throw new IOException("Cannot create file " + equalFile2
+                    + " as the parent directory does not exist");
+        }
+        final BufferedOutputStream output1 =
+                new BufferedOutputStream(new FileOutputStream(equalFile2));
+        try {
+            TestUtils.generateTestData(output1, (long) 48);
+        } finally {
+            IOUtils.closeQuietly(output1);
+        }
+        if (!moreFile.getParentFile().exists()) {
+            throw new IOException("Cannot create file " + moreFile
+                    + " as the parent directory does not exist");
+        }
+        final BufferedOutputStream output =
+                new BufferedOutputStream(new FileOutputStream(moreFile));
+        try {
+            TestUtils.generateTestData(output, (long) 48);
+        } finally {
+            IOUtils.closeQuietly(output);
+        }
     }
 
     /**
      * Test Constructor with null Iterable
      */
-    public void testConstructorIterable() {
+    @Test
+    public void constructorIterable_order() {
         final List<Comparator<File>> list = new ArrayList<Comparator<File>>();
         list.add(SizeFileComparator.SIZE_COMPARATOR);
         list.add(ExtensionFileComparator.EXTENSION_COMPARATOR);
@@ -72,7 +113,8 @@ public class CompositeFileComparatorTest
     /**
      * Test Constructor with null Iterable
      */
-    public void testConstructorIterableNull() {
+    @Test
+    public void constructorIterable_Null() {
         final Comparator<File> c = new 
CompositeFileComparator((Iterable<Comparator<File>>)null);
         assertEquals("less,more", 0, c.compare(lessFile, moreFile));
         assertEquals("more,less", 0, c.compare(moreFile, lessFile));
@@ -82,7 +124,8 @@ public class CompositeFileComparatorTest
     /**
      * Test Constructor with null array
      */
-    public void testConstructorArrayNull() {
+    @Test
+    public void constructorArray_Null() {
         final Comparator<File> c = new 
CompositeFileComparator((Comparator<File>[])null);
         assertEquals("less,more", 0, c.compare(lessFile, moreFile));
         assertEquals("more,less", 0, c.compare(moreFile, lessFile));

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/DefaultFileComparatorTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/DefaultFileComparatorTest.java?rev=1718944&r1=1718943&r2=1718944&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/DefaultFileComparatorTest.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/DefaultFileComparatorTest.java
 Wed Dec  9 19:50:30 2015
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.io.comparator;
 
+import org.junit.Before;
+
 import java.io.File;
 
 /**
@@ -23,19 +25,8 @@ import java.io.File;
  */
 public class DefaultFileComparatorTest extends ComparatorAbstractTestCase {
 
-    /**
-     * Construct a new test case with the specified name.
-     *
-     * @param name Name of the test
-     */
-    public DefaultFileComparatorTest(final String name) {
-        super(name);
-    }
-
-    /** @see junit.framework.TestCase#setUp() */
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         comparator = (AbstractFileComparator) 
DefaultFileComparator.DEFAULT_COMPARATOR;
         reverse = DefaultFileComparator.DEFAULT_REVERSE;
         equalFile1 = new File("foo");

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/DirectoryFileComparatorTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/DirectoryFileComparatorTest.java?rev=1718944&r1=1718943&r2=1718944&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/DirectoryFileComparatorTest.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/DirectoryFileComparatorTest.java
 Wed Dec  9 19:50:30 2015
@@ -16,6 +16,9 @@
  */
 package org.apache.commons.io.comparator;
 
+import org.junit.Before;
+import org.junit.Test;
+
 import java.io.File;
 
 /**
@@ -23,19 +26,8 @@ import java.io.File;
  */
 public class DirectoryFileComparatorTest extends ComparatorAbstractTestCase {
 
-    /**
-     * Construct a new test case with the specified name.
-     *
-     * @param name Name of the test
-     */
-    public DirectoryFileComparatorTest(final String name) {
-        super(name);
-    }
-
-    /** @see junit.framework.TestCase#setUp() */
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         comparator = (AbstractFileComparator) 
DirectoryFileComparator.DIRECTORY_COMPARATOR;
         reverse = DirectoryFileComparator.DIRECTORY_REVERSE;
         final File currentDir = new File(".");
@@ -48,7 +40,7 @@ public class DirectoryFileComparatorTest
     /**
      * Test the comparator array sort.
      */
-    @Override
+    @Test
     public void testSortArray() {
         // skip sort test
     }

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/ExtensionFileComparatorTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/ExtensionFileComparatorTest.java?rev=1718944&r1=1718943&r2=1718944&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/ExtensionFileComparatorTest.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/ExtensionFileComparatorTest.java
 Wed Dec  9 19:50:30 2015
@@ -16,27 +16,22 @@
  */
 package org.apache.commons.io.comparator;
 
+import org.junit.Before;
+import org.junit.Test;
+
 import java.io.File;
 import java.util.Comparator;
 
+import static org.junit.Assert.assertTrue;
+
 /**
  * Test case for {@link ExtensionFileComparator}.
  */
 public class ExtensionFileComparatorTest extends ComparatorAbstractTestCase {
 
-    /**
-     * Construct a new test case with the specified name.
-     *
-     * @param name Name of the test
-     */
-    public ExtensionFileComparatorTest(final String name) {
-        super(name);
-    }
 
-    /** @see junit.framework.TestCase#setUp() */
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         comparator = (AbstractFileComparator) 
ExtensionFileComparator.EXTENSION_COMPARATOR;
         reverse = ExtensionFileComparator.EXTENSION_REVERSE;
         equalFile1 = new File("abc.foo");
@@ -46,6 +41,7 @@ public class ExtensionFileComparatorTest
     }
 
     /** Test case sensitivity */
+    @Test
     public void testCaseSensitivity() {
         final File file3 = new File("abc.FOO");
         final Comparator<File> sensitive = new ExtensionFileComparator(null); 
/* test null as well */

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/LastModifiedFileComparatorTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/LastModifiedFileComparatorTest.java?rev=1718944&r1=1718943&r2=1718944&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/LastModifiedFileComparatorTest.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/LastModifiedFileComparatorTest.java
 Wed Dec  9 19:50:30 2015
@@ -16,34 +16,50 @@
  */
 package org.apache.commons.io.comparator;
 
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.testtools.TestUtils;
+import org.junit.Before;
+
+import java.io.BufferedOutputStream;
 import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
 
 /**
  * Test case for {@link LastModifiedFileComparator}.
  */
 public class LastModifiedFileComparatorTest extends ComparatorAbstractTestCase 
{
 
-    /**
-     * Construct a new test case with the specified name.
-     *
-     * @param name Name of the test
-     */
-    public LastModifiedFileComparatorTest(final String name) {
-        super(name);
-    }
-
-    /** @see junit.framework.TestCase#setUp() */
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         comparator = (AbstractFileComparator) 
LastModifiedFileComparator.LASTMODIFIED_COMPARATOR;
         reverse = LastModifiedFileComparator.LASTMODIFIED_REVERSE;
         final File dir = getTestDirectory();
         final File olderFile = new File(dir, "older.txt");
-        createFile(olderFile, 0);
+        if (!olderFile.getParentFile().exists()) {
+            throw new IOException("Cannot create file " + olderFile
+                    + " as the parent directory does not exist");
+        }
+        final BufferedOutputStream output2 =
+                new BufferedOutputStream(new FileOutputStream(olderFile));
+        try {
+            TestUtils.generateTestData(output2, (long) 0);
+        } finally {
+            IOUtils.closeQuietly(output2);
+        }
 
         final File equalFile = new File(dir, "equal.txt");
-        createFile(equalFile, 0);
+        if (!equalFile.getParentFile().exists()) {
+            throw new IOException("Cannot create file " + equalFile
+                    + " as the parent directory does not exist");
+        }
+        final BufferedOutputStream output1 =
+                new BufferedOutputStream(new FileOutputStream(equalFile));
+        try {
+            TestUtils.generateTestData(output1, (long) 0);
+        } finally {
+            IOUtils.closeQuietly(output1);
+        }
         do {
             try { 
                 Thread.sleep(300);
@@ -54,7 +70,17 @@ public class LastModifiedFileComparatorT
         } while( olderFile.lastModified() == equalFile.lastModified() );
 
         final File newerFile = new File(dir, "newer.txt");
-        createFile(newerFile, 0);
+        if (!newerFile.getParentFile().exists()) {
+            throw new IOException("Cannot create file " + newerFile
+                    + " as the parent directory does not exist");
+        }
+        final BufferedOutputStream output =
+                new BufferedOutputStream(new FileOutputStream(newerFile));
+        try {
+            TestUtils.generateTestData(output, (long) 0);
+        } finally {
+            IOUtils.closeQuietly(output);
+        }
         do {
             try { 
                 Thread.sleep(300);

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/NameFileComparatorTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/NameFileComparatorTest.java?rev=1718944&r1=1718943&r2=1718944&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/NameFileComparatorTest.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/NameFileComparatorTest.java
 Wed Dec  9 19:50:30 2015
@@ -16,27 +16,22 @@
  */
 package org.apache.commons.io.comparator;
 
+import org.junit.Before;
+import org.junit.Test;
+
 import java.io.File;
 import java.util.Comparator;
 
+import static org.junit.Assert.assertTrue;
+
 /**
  * Test case for {@link NameFileComparator}.
  */
 public class NameFileComparatorTest extends ComparatorAbstractTestCase {
 
-    /**
-     * Construct a new test case with the specified name.
-     *
-     * @param name Name of the test
-     */
-    public NameFileComparatorTest(final String name) {
-        super(name);
-    }
-
     /** @see junit.framework.TestCase#setUp() */
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         comparator = (AbstractFileComparator) 
NameFileComparator.NAME_INSENSITIVE_COMPARATOR;
         reverse = NameFileComparator.NAME_REVERSE;
         equalFile1 = new File("a/foo.txt");
@@ -46,6 +41,7 @@ public class NameFileComparatorTest exte
     }
 
     /** Test case sensitivity */
+    @Test
     public void testCaseSensitivity() {
         final File file3 = new File("a/FOO.txt");
         final Comparator<File> sensitive = new NameFileComparator(null); /* 
test null as well */

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/PathFileComparatorTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/PathFileComparatorTest.java?rev=1718944&r1=1718943&r2=1718944&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/PathFileComparatorTest.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/comparator/PathFileComparatorTest.java
 Wed Dec  9 19:50:30 2015
@@ -16,27 +16,22 @@
  */
 package org.apache.commons.io.comparator;
 
+import org.junit.Before;
+import org.junit.Test;
+
 import java.io.File;
 import java.util.Comparator;
 
+import static org.junit.Assert.assertTrue;
+
 /**
  * Test case for {@link PathFileComparator}.
  */
 public class PathFileComparatorTest extends ComparatorAbstractTestCase {
 
-    /**
-     * Construct a new test case with the specified name.
-     *
-     * @param name Name of the test
-     */
-    public PathFileComparatorTest(final String name) {
-        super(name);
-    }
 
-    /** @see junit.framework.TestCase#setUp() */
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    @Before
+    public void setUp() throws Exception {
         comparator = (AbstractFileComparator) 
PathFileComparator.PATH_COMPARATOR;
         reverse = PathFileComparator.PATH_REVERSE;
         equalFile1 = new File("foo/file.txt");
@@ -46,6 +41,7 @@ public class PathFileComparatorTest exte
     }
 
     /** Test case sensitivity */
+    @Test
     public void testCaseSensitivity() {
         final File file3 = new File("FOO/file.txt");
         final Comparator<File> sensitive = new PathFileComparator(null); /* 
test null as well */



Reply via email to