org.apache.commons.codec.binary
Class Base64Test

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

public class Base64Test
extends Object

Test cases for Base64 class.

Version:
$Id: Base64Test.html 889935 2013-12-11 05:05:13Z ggregory $
See Also:
RFC 2045

Constructor Summary
Base64Test()
           
 
Method Summary
 Random getRandom()
           
 void testBase64()
          Test the Base64 implementation
 void testByteToStringVariations()
           
 void testChunkedEncodeMultipleOf76()
          Tests Base64.encodeBase64().
 void testCodec112()
           
 void testCodec68()
          CODEC-68: isBase64 throws ArrayIndexOutOfBoundsException on some non-BASE64 bytes
 void testCodeInteger1()
           
 void testCodeInteger2()
           
 void testCodeInteger3()
           
 void testCodeInteger4()
           
 void testCodeIntegerEdgeCases()
           
 void testCodeIntegerNull()
           
 void testConstructor_Int_ByteArray_Boolean_UrlSafe()
           
 void testConstructor_Int_ByteArray_Boolean()
           
 void testConstructors()
           
 void testDecodePadMarkerIndex2()
          Tests conditional true branch for "marker0" test.
 void testDecodePadMarkerIndex3()
          Tests conditional branches for "marker1" test.
 void testDecodePadOnly()
           
 void testDecodePadOnlyChunked()
           
 void testDecodeWithWhitespace()
           
 void testEmptyBase64()
          Test encode and decode of empty byte array.
 void testEncodeDecodeRandom()
           
 void testEncodeDecodeSmall()
           
 void testEncodeOverMaxSize()
           
 void testHugeLineSeparator()
          Tests a lineSeparator much bigger than DEFAULT_BUFFER_SIZE.
 void testIgnoringNonBase64InDecode()
           
 void testIsArrayByteBase64()
           
 void testIsStringBase64()
          Test the isStringBase64 method.
 void testIsUrlSafe()
          Tests isUrlSafe.
 void testKnownDecodings()
           
 void testKnownEncodings()
           
 void testNonBase64Test()
           
 void testObjectDecodeWithInvalidParameter()
           
 void testObjectDecodeWithValidParameter()
           
 void testObjectEncode()
           
 void testObjectEncodeWithInvalidParameter()
           
 void testObjectEncodeWithValidParameter()
           
 void testPairs()
           
 void testRfc1421Section6Dot8ChunkSizeDefinition()
          Tests RFC 1421 section 4.3.2.4 chuck size definition.
 void testRfc2045Section2Dot1CrLfDefinition()
          Tests RFC 2045 section 2.1 CRLF definition.
 void testRfc2045Section6Dot8ChunkSizeDefinition()
          Tests RFC 2045 section 6.8 chuck size definition.
 void testRfc4648Section10Decode()
          Tests RFC 4648 section 10 test vectors.
 void testRfc4648Section10DecodeEncode()
          Tests RFC 4648 section 10 test vectors.
 void testRfc4648Section10DecodeWithCrLf()
          Tests RFC 4648 section 10 test vectors.
 void testRfc4648Section10Encode()
          Tests RFC 4648 section 10 test vectors.
 void testRfc4648Section10EncodeDecode()
          Tests RFC 4648 section 10 test vectors.
 void testSingletons()
           
 void testSingletonsChunked()
           
 void testStringToByteVariations()
           
 void testTriplets()
           
 void testTripletsChunked()
           
 void testUrlSafe()
          Tests url-safe Base64 against random data, sizes 0 to 150.
 void testUUID()
          Base64 encoding of UUID's is a common use-case, especially in URL-SAFE mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64Test

public Base64Test()
Method Detail

getRandom

public Random getRandom()
Returns:
Returns the _random.

testIsStringBase64

public void testIsStringBase64()
Test the isStringBase64 method.


testBase64

public void testBase64()
Test the Base64 implementation


testChunkedEncodeMultipleOf76

public void testChunkedEncodeMultipleOf76()
Tests Base64.encodeBase64().


testCodec68

public void testCodec68()
CODEC-68: isBase64 throws ArrayIndexOutOfBoundsException on some non-BASE64 bytes


testCodeInteger1

public void testCodeInteger1()

testCodeInteger2

public void testCodeInteger2()

testCodeInteger3

public void testCodeInteger3()

testCodeInteger4

public void testCodeInteger4()

testCodeIntegerEdgeCases

public void testCodeIntegerEdgeCases()

testCodeIntegerNull

public void testCodeIntegerNull()

testConstructors

public void testConstructors()

testConstructor_Int_ByteArray_Boolean

public void testConstructor_Int_ByteArray_Boolean()

testConstructor_Int_ByteArray_Boolean_UrlSafe

public void testConstructor_Int_ByteArray_Boolean_UrlSafe()

testDecodePadMarkerIndex2

public void testDecodePadMarkerIndex2()
Tests conditional true branch for "marker0" test.


testDecodePadMarkerIndex3

public void testDecodePadMarkerIndex3()
Tests conditional branches for "marker1" test.


testDecodePadOnly

public void testDecodePadOnly()

testDecodePadOnlyChunked

public void testDecodePadOnlyChunked()

testDecodeWithWhitespace

public void testDecodeWithWhitespace()
                              throws Exception
Throws:
Exception

testEmptyBase64

public void testEmptyBase64()
Test encode and decode of empty byte array.


testEncodeDecodeRandom

public void testEncodeDecodeRandom()

testEncodeDecodeSmall

public void testEncodeDecodeSmall()

testEncodeOverMaxSize

public void testEncodeOverMaxSize()
                           throws Exception
Throws:
Exception

testCodec112

public void testCodec112()

testIgnoringNonBase64InDecode

public void testIgnoringNonBase64InDecode()
                                   throws Exception
Throws:
Exception

testIsArrayByteBase64

public void testIsArrayByteBase64()

testIsUrlSafe

public void testIsUrlSafe()
Tests isUrlSafe.


testKnownDecodings

public void testKnownDecodings()

testKnownEncodings

public void testKnownEncodings()

testNonBase64Test

public void testNonBase64Test()
                       throws Exception
Throws:
Exception

testObjectDecodeWithInvalidParameter

public void testObjectDecodeWithInvalidParameter()
                                          throws Exception
Throws:
Exception

testObjectDecodeWithValidParameter

public void testObjectDecodeWithValidParameter()
                                        throws Exception
Throws:
Exception

testObjectEncodeWithInvalidParameter

public void testObjectEncodeWithInvalidParameter()
                                          throws Exception
Throws:
Exception

testObjectEncodeWithValidParameter

public void testObjectEncodeWithValidParameter()
                                        throws Exception
Throws:
Exception

testObjectEncode

public void testObjectEncode()
                      throws Exception
Throws:
Exception

testPairs

public void testPairs()

testRfc2045Section2Dot1CrLfDefinition

public void testRfc2045Section2Dot1CrLfDefinition()
Tests RFC 2045 section 2.1 CRLF definition.


testRfc2045Section6Dot8ChunkSizeDefinition

public void testRfc2045Section6Dot8ChunkSizeDefinition()
Tests RFC 2045 section 6.8 chuck size definition.


testRfc1421Section6Dot8ChunkSizeDefinition

public void testRfc1421Section6Dot8ChunkSizeDefinition()
Tests RFC 1421 section 4.3.2.4 chuck size definition.


testRfc4648Section10Decode

public void testRfc4648Section10Decode()
Tests RFC 4648 section 10 test vectors.

See Also:
http://tools.ietf.org/html/rfc4648

testRfc4648Section10DecodeWithCrLf

public void testRfc4648Section10DecodeWithCrLf()
Tests RFC 4648 section 10 test vectors.

See Also:
http://tools.ietf.org/html/rfc4648

testRfc4648Section10Encode

public void testRfc4648Section10Encode()
Tests RFC 4648 section 10 test vectors.

See Also:
http://tools.ietf.org/html/rfc4648

testRfc4648Section10DecodeEncode

public void testRfc4648Section10DecodeEncode()
Tests RFC 4648 section 10 test vectors.

See Also:
http://tools.ietf.org/html/rfc4648

testRfc4648Section10EncodeDecode

public void testRfc4648Section10EncodeDecode()
Tests RFC 4648 section 10 test vectors.

See Also:
http://tools.ietf.org/html/rfc4648

testSingletons

public void testSingletons()

testSingletonsChunked

public void testSingletonsChunked()

testTriplets

public void testTriplets()

testTripletsChunked

public void testTripletsChunked()

testUrlSafe

public void testUrlSafe()
Tests url-safe Base64 against random data, sizes 0 to 150.


testUUID

public void testUUID()
              throws org.apache.commons.codec.DecoderException
Base64 encoding of UUID's is a common use-case, especially in URL-SAFE mode. This test case ends up being the "URL-SAFE" JUnit's.

Throws:
org.apache.commons.codec.DecoderException - if Hex.decode() fails - a serious problem since Hex comes from our own commons-codec!

testByteToStringVariations

public void testByteToStringVariations()
                                throws org.apache.commons.codec.DecoderException
Throws:
org.apache.commons.codec.DecoderException

testStringToByteVariations

public void testStringToByteVariations()
                                throws org.apache.commons.codec.DecoderException
Throws:
org.apache.commons.codec.DecoderException

testHugeLineSeparator

public void testHugeLineSeparator()
Tests a lineSeparator much bigger than DEFAULT_BUFFER_SIZE.

See Also:
"dev@commons.apache.org"


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