You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2013/04/20 19:57:05 UTC
svn commit: r1470207 - in
/commons/proper/io/trunk/src/test/java/org/apache/commons/io:
IOUtilsCopyTestCase.java IOUtilsTestCase.java IOUtilsWriteTestCase.java
input/ReaderInputStreamTest.java
Author: sebb
Date: Sat Apr 20 17:57:05 2013
New Revision: 1470207
URL: http://svn.apache.org/r1470207
Log:
Suppress deprecation warnings for code that tests the deprecated methods
Modified:
commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsCopyTestCase.java
commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsTestCase.java
commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsWriteTestCase.java
commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsCopyTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsCopyTestCase.java?rev=1470207&r1=1470206&r2=1470207&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsCopyTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/IOUtilsCopyTestCase.java Sat Apr 20 17:57:05 2013
@@ -156,7 +156,7 @@ public class IOUtilsCopyTestCase extends
}
//-----------------------------------------------------------------------
- @SuppressWarnings("resource") // 'in' is deliberately not closed
+ @SuppressWarnings({ "resource", "deprecation" }) // 'in' is deliberately not closed
public void testCopy_inputStreamToWriter() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStream(in);
@@ -165,7 +165,7 @@ public class IOUtilsCopyTestCase extends
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
- IOUtils.copy(in, writer);
+ IOUtils.copy(in, writer); // deliberately testing deprecated method
out.off();
writer.flush();
@@ -174,6 +174,7 @@ public class IOUtilsCopyTestCase extends
assertTrue("Content differs", Arrays.equals(inData, baout.toByteArray()));
}
+ @SuppressWarnings("deprecation") // deliberately testing deprecated method
public void testCopy_inputStreamToWriter_nullIn() throws Exception {
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
final OutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
@@ -184,10 +185,11 @@ public class IOUtilsCopyTestCase extends
} catch (final NullPointerException ex) {}
}
+ @SuppressWarnings("deprecation") // deliberately testing deprecated method
public void testCopy_inputStreamToWriter_nullOut() throws Exception {
final InputStream in = new ByteArrayInputStream(inData);
try {
- IOUtils.copy(in, (Writer) null);
+ IOUtils.copy(in, (Writer) null); // deliberately testing deprecated method
fail();
} catch (final NullPointerException ex) {}
}
@@ -249,7 +251,7 @@ public class IOUtilsCopyTestCase extends
}
//-----------------------------------------------------------------------
- @SuppressWarnings("resource") // 'in' is deliberately not closed
+ @SuppressWarnings({ "resource", "deprecation" }) // 'in' is deliberately not closed
public void testCopy_readerToOutputStream() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStream(in);
@@ -258,7 +260,7 @@ public class IOUtilsCopyTestCase extends
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
final OutputStream out = new YellOnFlushAndCloseOutputStream(baout, false, true);
- IOUtils.copy(reader, out);
+ IOUtils.copy(reader, out); // deliberately testing deprecated method
//Note: this method *does* flush. It is equivalent to:
// OutputStreamWriter _out = new OutputStreamWriter(fout);
// IOUtils.copy( fin, _out, 4096 ); // copy( Reader, Writer, int );
@@ -270,7 +272,8 @@ public class IOUtilsCopyTestCase extends
assertTrue("Content differs", Arrays.equals(inData, baout.toByteArray()));
}
- public void testCopy_readerToOutputStream_nullIn() throws Exception {
+ @SuppressWarnings("deprecation")
+ public void testCopy_readerToOutputStream_nullIn() throws Exception { // deliberately testing deprecated method
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
final OutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
try {
@@ -279,13 +282,13 @@ public class IOUtilsCopyTestCase extends
} catch (final NullPointerException ex) {}
}
- @SuppressWarnings("resource") // 'in' is deliberately not closed
+ @SuppressWarnings({ "resource", "deprecation" }) // 'in' is deliberately not closed
public void testCopy_readerToOutputStream_nullOut() throws Exception {
InputStream in = new ByteArrayInputStream(inData);
in = new YellOnCloseInputStream(in);
final Reader reader = new InputStreamReader(in, "US-ASCII");
try {
- IOUtils.copy(reader, (OutputStream) null);
+ IOUtils.copy(reader, (OutputStream) null); // deliberately testing deprecated method
fail();
} catch (final NullPointerException ex) {}
}
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=1470207&r1=1470206&r2=1470207&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 Sat Apr 20 17:57:05 2013
@@ -705,6 +705,7 @@ public class IOUtilsTestCase extends Fil
IOUtils.closeQuietly(reader);
}
+ @SuppressWarnings("deprecation") // deliberately testing deprecated method
public void testReadLines_InputStream() throws Exception {
final File file = newFile("lines.txt");
InputStream in = null;
@@ -986,6 +987,7 @@ public class IOUtilsTestCase extends Fil
}
}
+ @SuppressWarnings("deprecation") // deliberately testing deprecated method
public void testToByteArray_Reader() throws IOException {
final String charsetName = "UTF-8";
final byte[] expecteds = charsetName.getBytes(charsetName);
@@ -1033,6 +1035,7 @@ public class IOUtilsTestCase extends Fil
Assert.assertEquals(FILE_SIZE, actual.length);
}
+ @SuppressWarnings("deprecation") // deliberately testing deprecated method
public void testToCharArray_InputStream() throws Exception {
final FileInputStream fin = new FileInputStream(m_testFile);
try {
@@ -1079,9 +1082,11 @@ public class IOUtilsTestCase extends Fil
* @throws Exception
* on error
*/
+ @SuppressWarnings("javadoc") // deliberately testing deprecated method
public void testToInputStream_CharSequence() throws Exception {
final CharSequence csq = new StringBuilder("Abc123Xyz!");
- InputStream inStream = IOUtils.toInputStream(csq);
+ @SuppressWarnings("deprecation")
+ InputStream inStream = IOUtils.toInputStream(csq); // deliberately testing deprecated method
byte[] bytes = IOUtils.toByteArray(inStream);
assertEqualContent(csq.toString().getBytes(), bytes);
inStream = IOUtils.toInputStream(csq, (String) null);
@@ -1102,8 +1107,10 @@ public class IOUtilsTestCase extends Fil
* @throws Exception
* on error
*/
+ @SuppressWarnings("javadoc") // deliberately testing deprecated method
public void testToInputStream_String() throws Exception {
final String str = "Abc123Xyz!";
+ @SuppressWarnings("deprecation") // deliberately testing deprecated method
InputStream inStream = IOUtils.toInputStream(str);
byte[] bytes = IOUtils.toByteArray(inStream);
assertEqualContent(str.getBytes(), bytes);
@@ -1129,6 +1136,7 @@ public class IOUtilsTestCase extends Fil
}
}
+ @SuppressWarnings("deprecation") // deliberately testing deprecated method
public void testToString_InputStream() throws Exception {
final FileInputStream fin = new FileInputStream(m_testFile);
try {
@@ -1152,6 +1160,7 @@ public class IOUtilsTestCase extends Fil
}
}
+ @SuppressWarnings("deprecation") // deliberately testing deprecated method
public void testToString_URI() throws Exception {
final URI url = m_testFile.toURI();
final String out = IOUtils.toString(url);
@@ -1174,6 +1183,7 @@ public class IOUtilsTestCase extends Fil
testToString_URI(null);
}
+ @SuppressWarnings("deprecation") // deliberately testing deprecated method
public void testToString_URL() throws Exception {
final URL url = m_testFile.toURI().toURL();
final String out = IOUtils.toString(url);
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=1470207&r1=1470206&r2=1470207&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 Sat Apr 20 17:57:05 2013
@@ -32,6 +32,7 @@ import org.apache.commons.io.testtools.Y
* @version $Id$
* @see IOUtils
*/
+@SuppressWarnings("deprecation") // includes tests for deprecated methods
public class IOUtilsWriteTestCase extends FileBasedTestCase {
private static final int FILE_SIZE = 1024 * 4 + 1;
Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java?rev=1470207&r1=1470206&r2=1470207&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java Sat Apr 20 17:57:05 2013
@@ -105,6 +105,7 @@ public class ReaderInputStreamTest {
testWithSingleByteRead(TEST_STRING, "UTF-16");
}
+ @SuppressWarnings("deprecation")
@Test
public void testReadZero() throws Exception {
final String inStr = "test";
@@ -117,6 +118,7 @@ public class ReaderInputStreamTest {
r.close();
}
+ @SuppressWarnings("deprecation")
@Test
public void testReadZeroEmptyString() throws Exception {
final ReaderInputStream r = new ReaderInputStream(new StringReader(""));