org.apache.commons.io
Class IOUtilsTestCase
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.apache.commons.io.testtools.FileBasedTestCase
org.apache.commons.io.IOUtilsTestCase
- All Implemented Interfaces:
- junit.framework.Test
public class IOUtilsTestCase
- extends FileBasedTestCase
This is used to test IOUtils for correctness. The following checks are performed:
- The return must not be null, must be the same type and equals() to the method's second arg
- All bytes must have been read from the source (available() == 0)
- The source and destination content must be identical (byte-wise comparison check)
- The output stream must not have been closed (a byte/char is written to test this, and
subsequent size checked)
Due to interdependencies in IOUtils and IOUtilsTestlet, one bug may cause
multiple tests to fail.
- Author:
- Jeff Turner, Gareth Davis, Ian Springer
| Methods inherited from class org.apache.commons.io.testtools.FileBasedTestCase |
assertEqualContent, assertEqualContent, checkFile, checkWrite, checkWrite, createFile, createLineBasedFile, deleteFile, generateTestData, generateTestData, getTestDirectory, newFile |
| Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString |
| Methods inherited from class junit.framework.Assert |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
IOUtilsTestCase
public IOUtilsTestCase(java.lang.String name)
setUp
public void setUp()
- Overrides:
setUp in class junit.framework.TestCase
tearDown
public void tearDown()
- Overrides:
tearDown in class junit.framework.TestCase
testConstants
public void testConstants()
throws java.lang.Exception
- Throws:
java.lang.Exception
testInputStreamToString
public void testInputStreamToString()
throws java.lang.Exception
- Throws:
java.lang.Exception
testReaderToString
public void testReaderToString()
throws java.lang.Exception
- Throws:
java.lang.Exception
testStringToOutputStream
public void testStringToOutputStream()
throws java.lang.Exception
- Throws:
java.lang.Exception
testStringToWriter
public void testStringToWriter()
throws java.lang.Exception
- Throws:
java.lang.Exception
testInputStreamToByteArray
public void testInputStreamToByteArray()
throws java.lang.Exception
- Throws:
java.lang.Exception
testStringToByteArray
public void testStringToByteArray()
throws java.lang.Exception
- Throws:
java.lang.Exception
testByteArrayToWriter
public void testByteArrayToWriter()
throws java.lang.Exception
- Throws:
java.lang.Exception
testByteArrayToString
public void testByteArrayToString()
throws java.lang.Exception
- Throws:
java.lang.Exception
testCharSequenceToInputStream
public void testCharSequenceToInputStream()
throws java.lang.Exception
- Test for
IOUtils#toInputStream(CharSequence) and IOUtils#toInputStream(CharSequence, String).
Note, this test utilizes on IOUtils#toByteArray(java.io.InputStream) and so relies on
testInputStreamToByteArray() to ensure this method functions correctly.
- Throws:
java.lang.Exception - on error
testStringToInputStream
public void testStringToInputStream()
throws java.lang.Exception
- Test for
IOUtils#toInputStream(String) and IOUtils#toInputStream(String, String).
Note, this test utilizes on IOUtils#toByteArray(java.io.InputStream) and so relies on
testInputStreamToByteArray() to ensure this method functions correctly.
- Throws:
java.lang.Exception - on error
testByteArrayToOutputStream
public void testByteArrayToOutputStream()
throws java.lang.Exception
- Throws:
java.lang.Exception
testInputStreamToCharArray
public void testInputStreamToCharArray()
throws java.lang.Exception
- Throws:
java.lang.Exception
testInputStreamToCharArrayWithEncoding
public void testInputStreamToCharArrayWithEncoding()
throws java.lang.Exception
- Throws:
java.lang.Exception
testReaderToCharArray
public void testReaderToCharArray()
throws java.lang.Exception
- Throws:
java.lang.Exception
testReadLines_InputStream
public void testReadLines_InputStream()
throws java.lang.Exception
- Throws:
java.lang.Exception
testReadLines_InputStream_String
public void testReadLines_InputStream_String()
throws java.lang.Exception
- Throws:
java.lang.Exception
testReadLines_Reader
public void testReadLines_Reader()
throws java.lang.Exception
- Throws:
java.lang.Exception
Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.