org.apache.commons.codec.binary
Class Base64InputStreamTest

java.lang.Object
  extended by org.apache.commons.codec.binary.Base64InputStreamTest

public class Base64InputStreamTest
extends Object

Since:
1.4
Version:
$Id $

Constructor Summary
Base64InputStreamTest()
           
 
Method Summary
 void testAvailable()
          Tests skipping past the end of a stream.
 void testBase64EmptyInputStreamMimeChuckSize()
          Tests the Base64InputStream implementation against empty input.
 void testBase64EmptyInputStreamPemChuckSize()
          Tests the Base64InputStream implementation against empty input.
 void testBase64InputStreamByChunk()
          Tests the Base64InputStream implementation.
 void testBase64InputStreamByteByByte()
          Tests the Base64InputStream implementation.
 void testCodec101()
          Test for the CODEC-101 bug: InputStream.read(byte[]) should never return 0 because Java's builtin InputStreamReader hates that.
 void testCodec105()
          Tests the bug reported in CODEC-105.
 void testCodec130()
          Tests the problem reported in CODEC-130.
 void testCodec98NPE()
          Test the Base64InputStream implementation against the special NPE inducing input identified in the CODEC-98 bug.
 void testInputStreamReader()
          Another test for the CODEC-101 bug: In commons-codec-1.4 this test shows InputStreamReader explicitly hating an InputStream.read(byte[]) return of 0: java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:268) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at org.apache.commons.codec.binary.Base64InputStreamTest.testInputStreamReader(Base64InputStreamTest.java:75) But in commons-codec-1.5 it's fixed.
 void testMarkSupported()
          Tests markSupported.
 void testRead0()
          Tests read returning 0
 void testReadNull()
          Tests read with null.
 void testReadOutOfBounds()
          Tests read throwing IndexOutOfBoundsException
 void testSkipBig()
          Tests skipping number of characters larger than the internal buffer.
 void testSkipNone()
          Tests skipping as a noop
 void testSkipPastEnd()
          Tests skipping past the end of a stream.
 void testSkipToEnd()
          Tests skipping to the end of a stream.
 void testSkipWrongArgument()
          Tests if negative arguments to skip are handled correctly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64InputStreamTest

public Base64InputStreamTest()
Method Detail

testCodec130

public void testCodec130()
                  throws IOException
Tests the problem reported in CODEC-130. Missing / wrong implementation of skip.

Throws:
IOException

testCodec105

public void testCodec105()
                  throws IOException
Tests the bug reported in CODEC-105. Bad interactions with InputStream when reading one byte at a time.

Throws:
IOException

testCodec101

public void testCodec101()
                  throws Exception
Test for the CODEC-101 bug: InputStream.read(byte[]) should never return 0 because Java's builtin InputStreamReader hates that.

Throws:
Exception - for some failure scenarios.

testInputStreamReader

public void testInputStreamReader()
                           throws Exception
Another test for the CODEC-101 bug: In commons-codec-1.4 this test shows InputStreamReader explicitly hating an InputStream.read(byte[]) return of 0: java.io.IOException: Underlying input stream returned zero bytes at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:268) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at org.apache.commons.codec.binary.Base64InputStreamTest.testInputStreamReader(Base64InputStreamTest.java:75) But in commons-codec-1.5 it's fixed. :-)

Throws:
Exception - for some failure scenarios.

testCodec98NPE

public void testCodec98NPE()
                    throws Exception
Test the Base64InputStream implementation against the special NPE inducing input identified in the CODEC-98 bug.

Throws:
Exception - for some failure scenarios.

testAvailable

public void testAvailable()
                   throws Throwable
Tests skipping past the end of a stream.

Throws:
Throwable

testBase64EmptyInputStreamMimeChuckSize

public void testBase64EmptyInputStreamMimeChuckSize()
                                             throws Exception
Tests the Base64InputStream implementation against empty input.

Throws:
Exception - for some failure scenarios.

testBase64EmptyInputStreamPemChuckSize

public void testBase64EmptyInputStreamPemChuckSize()
                                            throws Exception
Tests the Base64InputStream implementation against empty input.

Throws:
Exception - for some failure scenarios.

testBase64InputStreamByChunk

public void testBase64InputStreamByChunk()
                                  throws Exception
Tests the Base64InputStream implementation.

Throws:
Exception - for some failure scenarios.

testBase64InputStreamByteByByte

public void testBase64InputStreamByteByByte()
                                     throws Exception
Tests the Base64InputStream implementation.

Throws:
Exception - for some failure scenarios.

testMarkSupported

public void testMarkSupported()
                       throws Exception
Tests markSupported.

Throws:
Exception

testRead0

public void testRead0()
               throws Exception
Tests read returning 0

Throws:
Exception

testReadNull

public void testReadNull()
                  throws Exception
Tests read with null.

Throws:
Exception - for some failure scenarios.

testReadOutOfBounds

public void testReadOutOfBounds()
                         throws Exception
Tests read throwing IndexOutOfBoundsException

Throws:
Exception

testSkipBig

public void testSkipBig()
                 throws Throwable
Tests skipping number of characters larger than the internal buffer.

Throws:
Throwable

testSkipNone

public void testSkipNone()
                  throws Throwable
Tests skipping as a noop

Throws:
Throwable

testSkipPastEnd

public void testSkipPastEnd()
                     throws Throwable
Tests skipping past the end of a stream.

Throws:
Throwable

testSkipToEnd

public void testSkipToEnd()
                   throws Throwable
Tests skipping to the end of a stream.

Throws:
Throwable

testSkipWrongArgument

public void testSkipWrongArgument()
                           throws Throwable
Tests if negative arguments to skip are handled correctly.

Throws:
Throwable


Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.