Don't use "m_" prefix for instance variables.
MODIFY
src/test/java/org/apache/commons/io/DemuxTestCase.java
src/test/java/org/apache/commons/io/DemuxTestCase.java
private static final String DATA4 = "Data for thread4";
private static final Random c_random = new Random();
- private final HashMap<String, ByteArrayOutputStream> m_outputMap = new HashMap<>();
- private final HashMap<String, Thread> m_threadMap = new HashMap<>();
+ private final HashMap<String, ByteArrayOutputStream> outputMap = new HashMap<>();
+ private final HashMap<String, Thread> threadMap = new HashMap<>();
private String getOutput(final String threadName) {
final ByteArrayOutputStream output =
- m_outputMap.get(threadName);
+ outputMap.get(threadName);
assertNotNull(output, "getOutput()");
return output.toString(StandardCharsets.UTF_8);
}
private String getInput(final String threadName) {
- final ReaderThread thread = (ReaderThread) m_threadMap.get(threadName);
+ final ReaderThread thread = (ReaderThread) threadMap.get(threadName);
assertNotNull(thread, "getInput()");
return thread.getData();
}
private void doStart() {
- for (final String name : m_threadMap.keySet()) {
- final Thread thread = m_threadMap.get(name);
+ for (final String name : threadMap.keySet()) {
+ final Thread thread = threadMap.get(name);
thread.start();
}
}
private void doJoin()
throws Exception {
- for (final String name : m_threadMap.keySet()) {
- final Thread thread = m_threadMap.get(name);
+ for (final String name : threadMap.keySet()) {
+ final Thread thread = threadMap.get(name);
thread.join();
}
}
@@ -84,10 +84,10 @@ private void startWriter(final String name,
final String data,
final DemuxOutputStream demux) {
final ByteArrayOutputStream output = new ByteArrayOutputStream();
- m_outputMap.put(name, output);
+ outputMap.put(name, output);
final WriterThread thread =
new WriterThread(name, data, output, demux);
- m_threadMap.put(name, thread);
+ threadMap.put(name, thread);
}
private void startReader(final String name,
@@ -95,7 +95,7 @@ private void startReader(final String name,
final DemuxInputStream demux) {
final ByteArrayInputStream input = new ByteArrayInputStream(data.getBytes());
final ReaderThread thread = new ReaderThread(name, input, demux);
- m_threadMap.put(name, thread);
+ threadMap.put(name, thread);
}
@Test
@@ -136,35 +136,35 @@ public void testInputStream()
private static class ReaderThread
extends Thread {
- private final StringBuffer m_buffer = new StringBuffer();
- private final InputStream m_input;
- private final DemuxInputStream m_demux;
+ private final StringBuffer stringBuffer = new StringBuffer();
+ private final InputStream inputStream;
+ private final DemuxInputStream demuxInputStream;
ReaderThread(final String name,
final InputStream input,
final DemuxInputStream demux) {
super(name);
- m_input = input;
- m_demux = demux;
+ inputStream = input;
+ demuxInputStream = demux;
}
public String getData() {
- return m_buffer.toString();
+ return stringBuffer.toString();
}
@Override
public void run() {
- m_demux.bindStream(m_input);
+ demuxInputStream.bindStream(inputStream);
try {
- int ch = m_demux.read();
+ int ch = demuxInputStream.read();
while (-1 != ch) {
//System.out.println( "Reading: " + (char)ch );
- m_buffer.append((char) ch);
+ stringBuffer.append((char) ch);
final int sleepTime = Math.abs(c_random.nextInt() % 10);
TestUtils.sleep(sleepTime);
- ch = m_demux.read();
+ ch = demuxInputStream.read();
}
} catch (final Exception e) {
e.printStackTrace();
@@ -174,27 +174,27 @@ public void run() {
private static class WriterThread
extends Thread {
- private final byte[] m_data;
- private final OutputStream m_output;
- private final DemuxOutputStream m_demux;
+ private final byte[] byteArray;
+ private final OutputStream outputStream;
+ private final DemuxOutputStream demuxOutputStream;
WriterThread(final String name,
final String data,
final OutputStream output,
final DemuxOutputStream demux) {
super(name);
- m_output = output;
- m_demux = demux;
- m_data = data.getBytes();
+ outputStream = output;
+ demuxOutputStream = demux;
+ byteArray = data.getBytes();
}
@Override
public void run() {
- m_demux.bindStream(m_output);
- for (final byte element : m_data) {
+ demuxOutputStream.bindStream(outputStream);
+ for (final byte element : byteArray) {
try {
- //System.out.println( "Writing: " + (char)m_data[ i ] );
- m_demux.write(element);
+ //System.out.println( "Writing: " + (char)byteArray[ i ] );
+ demuxOutputStream.write(element);
final int sleepTime = Math.abs(c_random.nextInt() % 10);
TestUtils.sleep(sleepTime);
} catch (final Exception e) {

MODIFY
src/test/java/org/apache/commons/io/FileUtilsFileNewerTestCase.java
src/test/java/org/apache/commons/io/FileUtilsFileNewerTestCase.java
private static final int FILE1_SIZE = 1;
private static final int FILE2_SIZE = 1024 * 4 + 1;
- private File m_testFile1;
- private File m_testFile2;
+ private File testFile1;
+ private File testFile2;
@BeforeEach
public void setUp() throws Exception {
- m_testFile1 = new File(temporaryFolder, "file1-test.txt");
- m_testFile2 = new File(temporaryFolder, "file2-test.txt");
- if (!m_testFile1.getParentFile().exists()) {
- throw new IOException("Cannot create file " + m_testFile1
+ testFile1 = new File(temporaryFolder, "file1-test.txt");
+ testFile2 = new File(temporaryFolder, "file2-test.txt");
+ if (!testFile1.getParentFile().exists()) {
+ throw new IOException("Cannot create file " + testFile1
+ " as the parent directory does not exist");
}
try (final BufferedOutputStream output1 =
- new BufferedOutputStream(new FileOutputStream(m_testFile1))) {
+ new BufferedOutputStream(new FileOutputStream(testFile1))) {
TestUtils.generateTestData(output1, FILE1_SIZE);
}
- if (!m_testFile2.getParentFile().exists()) {
- throw new IOException("Cannot create file " + m_testFile2
+ if (!testFile2.getParentFile().exists()) {
+ throw new IOException("Cannot create file " + testFile2
+ " as the parent directory does not exist");
}
try (final BufferedOutputStream output =
- new BufferedOutputStream(new FileOutputStream(m_testFile2))) {
+ new BufferedOutputStream(new FileOutputStream(testFile2))) {
TestUtils.generateTestData(output, FILE2_SIZE);
}
}
@@ -76,16 +76,16 @@ public void setUp() throws Exception {
*/
@Test
public void testIsFileNewer() {
- if (!m_testFile1.exists()) {
- throw new IllegalStateException("The m_testFile1 should exist");
+ if (!testFile1.exists()) {
+ throw new IllegalStateException("The testFile1 should exist");
}
- final long fileLastModified = m_testFile1.lastModified();
+ final long fileLastModified = testFile1.lastModified();
final long TWO_SECOND = 2000;
- testIsFileNewer("two second earlier is not newer" , m_testFile1, fileLastModified + TWO_SECOND, false);
- testIsFileNewer("same time is not newer" , m_testFile1, fileLastModified, false);
- testIsFileNewer("two second later is newer" , m_testFile1, fileLastModified - TWO_SECOND, true);
+ testIsFileNewer("two second earlier is not newer" , testFile1, fileLastModified + TWO_SECOND, false);
+ testIsFileNewer("same time is not newer" , testFile1, fileLastModified, false);
+ testIsFileNewer("two second later is newer" , testFile1, fileLastModified - TWO_SECOND, true);
}
/**
@@ -102,7 +102,7 @@ public void testIsFileNewerImaginaryFile() {
throw new IllegalStateException("The imaginary File exists");
}
- testIsFileNewer("imaginary file can be newer" , imaginaryFile, m_testFile2.lastModified(), false);
+ testIsFileNewer("imaginary file can be newer" , imaginaryFile, testFile2.lastModified(), false);
}
/**
@@ -132,7 +132,7 @@ protected void testIsFileNewer(final String description, final File file, final
assertEquals(wantedResult, FileUtils.isFileNewer(file, time), description + " - time");
assertEquals(wantedResult, FileUtils.isFileNewer(file, new Date(time)), description + " - date");
- final File temporaryFile = m_testFile2;
+ final File temporaryFile = testFile2;
temporaryFile.setLastModified(time);
assertEquals(time, temporaryFile.lastModified(), "The temporary file hasn't the right last modification date");
@@ -157,7 +157,7 @@ public void testIsFileNewerNoFile() {
*/
@Test
public void testIsFileNewerNoDate() {
- assertThrows(NullPointerException.class, () -> FileUtils.isFileNewer(m_testFile1, (Date) null),
+ assertThrows(NullPointerException.class, () -> FileUtils.isFileNewer(testFile1, (Date) null),
"date");
}
@@ -168,7 +168,7 @@ public void testIsFileNewerNoDate() {
*/
@Test
public void testIsFileNewerNoFileReference() {
- assertThrows(NullPointerException.class, () -> FileUtils.isFileNewer(m_testFile1, (File) null),
+ assertThrows(NullPointerException.class, () -> FileUtils.isFileNewer(testFile1, (File) null),
"reference");
}
}

MODIFY
src/test/java/org/apache/commons/io/IOUtilsTestCase.java
src/test/java/org/apache/commons/io/IOUtilsTestCase.java
private byte[] iarr;
- private File m_testFile;
+ private File testFile;
/** Assert that the contents of two byte arrays are the same. */
private void assertEqualContent(final byte[] b0, final byte[] b1) {
@@ -113,12 +113,12 @@ private void assertEqualContent(final byte[] b0, final byte[] b1) {
@BeforeEach
public void setUp() {
try {
- m_testFile = new File(temporaryFolder, "file2-test.txt");
+ testFile = new File(temporaryFolder, "file2-test.txt");
- if (!m_testFile.getParentFile().exists()) {
- throw new IOException("Cannot create file " + m_testFile + " as the parent directory does not exist");
+ if (!testFile.getParentFile().exists()) {
+ throw new IOException("Cannot create file " + testFile + " as the parent directory does not exist");
}
- final BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(m_testFile));
+ final BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(testFile));
try {
TestUtils.generateTestData(output, FILE_SIZE);
} finally {
@@ -617,7 +617,7 @@ public void testContentEqualsIgnoreEOL() throws Exception {
public void testCopy_ByteArray_OutputStream() throws Exception {
final File destination = TestUtils.newFile(temporaryFolder, "copy8.txt");
byte[] in;
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
+ try (FileInputStream fin = new FileInputStream(testFile)) {
// Create our byte[]. Rely on testInputStreamToByteArray() to make sure this is valid.
in = IOUtils.toByteArray(fin);
}
@@ -627,7 +627,7 @@ public void testCopy_ByteArray_OutputStream() throws Exception {
fout.flush();
- TestUtils.checkFile(destination, m_testFile);
+ TestUtils.checkFile(destination, testFile);
TestUtils.checkWrite(fout);
}
TestUtils.deleteFile(destination);
@@ -637,7 +637,7 @@ public void testCopy_ByteArray_OutputStream() throws Exception {
public void testCopy_ByteArray_Writer() throws Exception {
final File destination = TestUtils.newFile(temporaryFolder, "copy7.txt");
byte[] in;
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
+ try (FileInputStream fin = new FileInputStream(testFile)) {
// Create our byte[]. Rely on testInputStreamToByteArray() to make sure this is valid.
in = IOUtils.toByteArray(fin);
}
@@ -645,7 +645,7 @@ public void testCopy_ByteArray_Writer() throws Exception {
try (FileWriter fout = new FileWriter(destination)) {
CopyUtils.copy(in, fout);
fout.flush();
- TestUtils.checkFile(destination, m_testFile);
+ TestUtils.checkFile(destination, testFile);
TestUtils.checkWrite(fout);
}
TestUtils.deleteFile(destination);
@@ -655,7 +655,7 @@ public void testCopy_ByteArray_Writer() throws Exception {
public void testCopy_String_Writer() throws Exception {
final File destination = TestUtils.newFile(temporaryFolder, "copy6.txt");
String str;
- try (FileReader fin = new FileReader(m_testFile)) {
+ try (FileReader fin = new FileReader(testFile)) {
// Create our String. Rely on testReaderToString() to make sure this is valid.
str = IOUtils.toString(fin);
}
@@ -664,7 +664,7 @@ public void testCopy_String_Writer() throws Exception {
CopyUtils.copy(str, fout);
fout.flush();
- TestUtils.checkFile(destination, m_testFile);
+ TestUtils.checkFile(destination, testFile);
TestUtils.checkWrite(fout);
}
TestUtils.deleteFile(destination);
@@ -891,7 +891,7 @@ public void testCopyLarge_SkipWithInvalidOffset() throws IOException {
@Test
public void testRead_ReadableByteChannel() throws Exception {
final ByteBuffer buffer = ByteBuffer.allocate(FILE_SIZE);
- final FileInputStream fileInputStream = new FileInputStream(m_testFile);
+ final FileInputStream fileInputStream = new FileInputStream(testFile);
final FileChannel input = fileInputStream.getChannel();
try {
assertEquals(FILE_SIZE, IOUtils.read(input, buffer));
@@ -960,7 +960,7 @@ public void testReadFully_InputStream_Offset() throws Exception {
@Test
public void testReadFully_ReadableByteChannel() throws Exception {
final ByteBuffer buffer = ByteBuffer.allocate(FILE_SIZE);
- final FileInputStream fileInputStream = new FileInputStream(m_testFile);
+ final FileInputStream fileInputStream = new FileInputStream(testFile);
final FileChannel input = fileInputStream.getChannel();
try {
IOUtils.readFully(input, buffer);
@@ -1258,7 +1258,7 @@ public void testResourceToURL_Null_WithClassLoader() {
@Test
public void testSkip_FileReader() throws Exception {
- try (FileReader in = new FileReader(m_testFile)) {
+ try (FileReader in = new FileReader(testFile)) {
assertEquals(FILE_SIZE - 10, IOUtils.skip(in, FILE_SIZE - 10));
assertEquals(10, IOUtils.skip(in, 20));
assertEquals(0, IOUtils.skip(in, 10));
@@ -1267,7 +1267,7 @@ public void testSkip_FileReader() throws Exception {
@Test
public void testSkip_InputStream() throws Exception {
- try (InputStream in = new FileInputStream(m_testFile)) {
+ try (InputStream in = new FileInputStream(testFile)) {
assertEquals(FILE_SIZE - 10, IOUtils.skip(in, FILE_SIZE - 10));
assertEquals(10, IOUtils.skip(in, 20));
assertEquals(0, IOUtils.skip(in, 10));
@@ -1276,7 +1276,7 @@ public void testSkip_InputStream() throws Exception {
@Test
public void testSkip_ReadableByteChannel() throws Exception {
- final FileInputStream fileInputStream = new FileInputStream(m_testFile);
+ final FileInputStream fileInputStream = new FileInputStream(testFile);
final FileChannel fileChannel = fileInputStream.getChannel();
try {
assertEquals(FILE_SIZE - 10, IOUtils.skip(fileChannel, FILE_SIZE - 10));
@@ -1312,7 +1312,7 @@ public void testSkipFully_InputStream() throws Exception {
@Test
public void testSkipFully_ReadableByteChannel() throws Exception {
- final FileInputStream fileInputStream = new FileInputStream(m_testFile);
+ final FileInputStream fileInputStream = new FileInputStream(testFile);
final FileChannel fileChannel = fileInputStream.getChannel();
try {
try {
@@ -1360,7 +1360,7 @@ public void testSkipFully_Reader() throws Exception {
public void testStringToOutputStream() throws Exception {
final File destination = TestUtils.newFile(temporaryFolder, "copy5.txt");
String str;
- try (FileReader fin = new FileReader(m_testFile)) {
+ try (FileReader fin = new FileReader(testFile)) {
// Create our String. Rely on testReaderToString() to make sure this is valid.
str = IOUtils.toString(fin);
}
@@ -1374,7 +1374,7 @@ public void testStringToOutputStream() throws Exception {
// out = fout;
// note: we don't flush here; this IOUtils method does it for us
- TestUtils.checkFile(destination, m_testFile);
+ TestUtils.checkFile(destination, testFile);
TestUtils.checkWrite(fout);
}
TestUtils.deleteFile(destination);
@@ -1382,43 +1382,43 @@ public void testStringToOutputStream() throws Exception {
@Test
public void testToBufferedInputStream_InputStream() throws Exception {
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
+ try (FileInputStream fin = new FileInputStream(testFile)) {
final InputStream in = IOUtils.toBufferedInputStream(fin);
final byte[] out = IOUtils.toByteArray(in);
assertNotNull(out);
assertEquals(0, fin.available(), "Not all bytes were read");
assertEquals(FILE_SIZE, out.length, "Wrong output size");
- TestUtils.assertEqualContent(out, m_testFile);
+ TestUtils.assertEqualContent(out, testFile);
}
}
@Test
public void testToBufferedInputStreamWithBufferSize_InputStream() throws Exception {
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
+ try (FileInputStream fin = new FileInputStream(testFile)) {
final InputStream in = IOUtils.toBufferedInputStream(fin, 2048);
final byte[] out = IOUtils.toByteArray(in);
assertNotNull(out);
assertEquals(0, fin.available(), "Not all bytes were read");
assertEquals(FILE_SIZE, out.length, "Wrong output size");
- TestUtils.assertEqualContent(out, m_testFile);
+ TestUtils.assertEqualContent(out, testFile);
}
}
@Test
public void testToByteArray_InputStream() throws Exception {
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
+ try (FileInputStream fin = new FileInputStream(testFile)) {
final byte[] out = IOUtils.toByteArray(fin);
assertNotNull(out);
assertEquals(0, fin.available(), "Not all bytes were read");
assertEquals(FILE_SIZE, out.length, "Wrong output size");
- TestUtils.assertEqualContent(out, m_testFile);
+ TestUtils.assertEqualContent(out, testFile);
}
}
@Test
public void testToByteArray_InputStream_NegativeSize() throws Exception {
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
+ try (FileInputStream fin = new FileInputStream(testFile)) {
IOUtils.toByteArray(fin, -1);
fail("IllegalArgumentException expected");
} catch (final IllegalArgumentException exc) {
@@ -1430,20 +1430,20 @@ public void testToByteArray_InputStream_NegativeSize() throws Exception {
@Test
public void testToByteArray_InputStream_Size() throws Exception {
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
- final byte[] out = IOUtils.toByteArray(fin, m_testFile.length());
+ try (FileInputStream fin = new FileInputStream(testFile)) {
+ final byte[] out = IOUtils.toByteArray(fin, testFile.length());
assertNotNull(out);
assertEquals(0, fin.available(), "Not all bytes were read");
assertEquals(FILE_SIZE, out.length, "Wrong output size: out.length=" + out.length + "!=" + FILE_SIZE);
- TestUtils.assertEqualContent(out, m_testFile);
+ TestUtils.assertEqualContent(out, testFile);
}
}
@Test
public void testToByteArray_InputStream_SizeIllegal() throws Exception {
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
- IOUtils.toByteArray(fin, m_testFile.length() + 1);
+ try (FileInputStream fin = new FileInputStream(testFile)) {
+ IOUtils.toByteArray(fin, testFile.length() + 1);
fail("IOException expected");
} catch (final IOException exc) {
assertTrue(exc.getMessage().startsWith("Unexpected read size"),
@@ -1455,7 +1455,7 @@ public void testToByteArray_InputStream_SizeIllegal() throws Exception {
@Test
public void testToByteArray_InputStream_SizeLong() throws Exception {
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
+ try (FileInputStream fin = new FileInputStream(testFile)) {
IOUtils.toByteArray(fin, (long) Integer.MAX_VALUE + 1);
fail("IOException expected");
} catch (final IllegalArgumentException exc) {
@@ -1468,7 +1468,7 @@ public void testToByteArray_InputStream_SizeLong() throws Exception {
@Test
public void testToByteArray_InputStream_SizeZero() throws Exception {
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
+ try (FileInputStream fin = new FileInputStream(testFile)) {
final byte[] out = IOUtils.toByteArray(fin, 0);
assertNotNull(out, "Out cannot be null");
assertEquals(0, out.length, "Out length must be 0");
@@ -1478,7 +1478,7 @@ public void testToByteArray_InputStream_SizeZero() throws Exception {
@Test
public void testToByteArray_InputStream_SizeOne() throws Exception {
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
+ try (FileInputStream fin = new FileInputStream(testFile)) {
final byte[] out = IOUtils.toByteArray(fin, 1);
assertNotNull(out, "Out cannot be null");
assertEquals(1, out.length, "Out length must be 1");
@@ -1497,7 +1497,7 @@ public void testToByteArray_Reader() throws IOException {
@Test
public void testToByteArray_String() throws Exception {
- try (FileReader fin = new FileReader(m_testFile)) {
+ try (FileReader fin = new FileReader(testFile)) {
// Create our String. Rely on testReaderToString() to make sure this is valid.
final String str = IOUtils.toString(fin);
@@ -1508,21 +1508,21 @@ public void testToByteArray_String() throws Exception {
@Test
public void testToByteArray_URI() throws Exception {
- final URI url = m_testFile.toURI();
+ final URI url = testFile.toURI();
final byte[] actual = IOUtils.toByteArray(url);
assertEquals(FILE_SIZE, actual.length);
}
@Test
public void testToByteArray_URL() throws Exception {
- final URL url = m_testFile.toURI().toURL();
+ final URL url = testFile.toURI().toURL();
final byte[] actual = IOUtils.toByteArray(url);
assertEquals(FILE_SIZE, actual.length);
}
@Test
public void testToByteArray_URLConnection() throws Exception {
- final URLConnection urlConn = m_testFile.toURI().toURL().openConnection();
+ final URLConnection urlConn = testFile.toURI().toURL().openConnection();
byte[] actual;
try {
actual = IOUtils.toByteArray(urlConn);
@@ -1534,33 +1534,33 @@ public void testToByteArray_URLConnection() throws Exception {
@Test
public void testToCharArray_InputStream() throws Exception {
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
+ try (FileInputStream fin = new FileInputStream(testFile)) {
final char[] out = IOUtils.toCharArray(fin);
assertNotNull(out);
assertEquals(0, fin.available(), "Not all chars were read");
assertEquals(FILE_SIZE, out.length, "Wrong output size");
- TestUtils.assertEqualContent(out, m_testFile);
+ TestUtils.assertEqualContent(out, testFile);
}
}
@Test
public void testToCharArray_InputStream_CharsetName() throws Exception {
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
+ try (FileInputStream fin = new FileInputStream(testFile)) {
final char[] out = IOUtils.toCharArray(fin, "UTF-8");
assertNotNull(out);
assertEquals(0, fin.available(), "Not all chars were read");
assertEquals(FILE_SIZE, out.length, "Wrong output size");
- TestUtils.assertEqualContent(out, m_testFile);
+ TestUtils.assertEqualContent(out, testFile);
}
}
@Test
public void testToCharArray_Reader() throws Exception {
- try (FileReader fr = new FileReader(m_testFile)) {
+ try (FileReader fr = new FileReader(testFile)) {
final char[] out = IOUtils.toCharArray(fr);
assertNotNull(out);
assertEquals(FILE_SIZE, out.length, "Wrong output size");
- TestUtils.assertEqualContent(out, m_testFile);
+ TestUtils.assertEqualContent(out, testFile);
}
}
@@ -1608,7 +1608,7 @@ public void testToInputStream_String() throws Exception {
@Test
public void testToString_ByteArray() throws Exception {
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
+ try (FileInputStream fin = new FileInputStream(testFile)) {
final byte[] in = IOUtils.toByteArray(fin);
// Create our byte[]. Rely on testInputStreamToByteArray() to make sure this is valid.
final String str = IOUtils.toString(in);
@@ -1618,7 +1618,7 @@ public void testToString_ByteArray() throws Exception {
@Test
public void testToString_InputStream() throws Exception {
- try (FileInputStream fin = new FileInputStream(m_testFile)) {
+ try (FileInputStream fin = new FileInputStream(testFile)) {
final String out = IOUtils.toString(fin);
assertNotNull(out);
assertEquals(0, fin.available(), "Not all bytes were read");
@@ -1628,7 +1628,7 @@ public void testToString_InputStream() throws Exception {
@Test
public void testToString_Reader() throws Exception {
- try (FileReader fin = new FileReader(m_testFile)) {
+ try (FileReader fin = new FileReader(testFile)) {
final String out = IOUtils.toString(fin);
assertNotNull(out);
assertEquals(FILE_SIZE, out.length(), "Wrong output size");
@@ -1637,14 +1637,14 @@ public void testToString_Reader() throws Exception {
@Test
public void testToString_URI() throws Exception {
- final URI url = m_testFile.toURI();
+ final URI url = testFile.toURI();
final String out = IOUtils.toString(url);
assertNotNull(out);
assertEquals(FILE_SIZE, out.length(), "Wrong output size");
}
private void testToString_URI(final String encoding) throws Exception {
- final URI uri = m_testFile.toURI();
+ final URI uri = testFile.toURI();
final String out = IOUtils.toString(uri, encoding);
assertNotNull(out);
assertEquals(FILE_SIZE, out.length(), "Wrong output size");
@@ -1662,14 +1662,14 @@ public void testToString_URI_CharsetNameNull() throws Exception {
@Test
public void testToString_URL() throws Exception {
- final URL url = m_testFile.toURI().toURL();
+ final URL url = testFile.toURI().toURL();
final String out = IOUtils.toString(url);
assertNotNull(out);
assertEquals(FILE_SIZE, out.length(), "Wrong output size");
}
private void testToString_URL(final String encoding) throws Exception {
- final URL url = m_testFile.toURI().toURL();
+ final URL url = testFile.toURI().toURL();
final String out = IOUtils.toString(url, encoding);
assertNotNull(out);
assertEquals(FILE_SIZE, out.length(), "Wrong output size");

Don't use "m_" prefix for instance variables.