org.apache.commons.io
Class IOUtilsTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.io.testtools.FileBasedTestCase
              extended by 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:

Due to interdependencies in IOUtils and IOUtilsTestlet, one bug may cause multiple tests to fail.

Author:
Jeff Turner, Gareth Davis, Ian Springer

Constructor Summary
IOUtilsTestCase(java.lang.String name)
           
 
Method Summary
 void setUp()
           
 void tearDown()
           
 void testByteArrayToOutputStream()
           
 void testByteArrayToString()
           
 void testByteArrayToWriter()
           
 void testCharSequenceToInputStream()
          Test for IOUtils#toInputStream(CharSequence) and IOUtils#toInputStream(CharSequence, String).
 void testConstants()
           
 void testInputStreamToByteArray()
           
 void testInputStreamToCharArray()
           
 void testInputStreamToCharArrayWithEncoding()
           
 void testInputStreamToString()
           
 void testReaderToCharArray()
           
 void testReaderToString()
           
 void testReadLines_InputStream_String()
           
 void testReadLines_InputStream()
           
 void testReadLines_Reader()
           
 void testStringToByteArray()
           
 void testStringToInputStream()
          Test for IOUtils#toInputStream(String) and IOUtils#toInputStream(String, String).
 void testStringToOutputStream()
           
 void testStringToWriter()
           
 
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
 

Constructor Detail

IOUtilsTestCase

public IOUtilsTestCase(java.lang.String name)
Method Detail

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.