Class Base32SupportTest
- java.lang.Object
-
- net.shibboleth.utilities.java.support.codec.Base32SupportTest
-
public class Base32SupportTest extends Object
Base32Supportunit test.
-
-
Field Summary
Fields Modifier and Type Field Description private static StringENCODED_TEXTBase32 encoded version ofPLAIN_TEXT.private static StringINVALID_BASE32Invalid base32, should not produce a result.private static StringINVALID_BASE32_TRAILINGInvalid base32 string as it has invalid trailing digits.private static StringPLAIN_TEXTA plain text string to be encoded.
-
Constructor Summary
Constructors Constructor Description Base32SupportTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidtestDecodeInvalidInput()Test that an invalid base32 input string does not return a response, instead throwing aDecodingException.voidtestDecodeInvalidTrailingBitsInput()Test that when the last encoded character (before the paddings if any) is a valid base 32 alphabet but not a possible value anDecodingExceptionis thrown.voidtestEncode()Test encoding a byte array works.voidtestEncodeNullInput()Test a null byte array argument violates the method contract and throws aConstraintViolationException.
-
-
-
Field Detail
-
PLAIN_TEXT
private static final String PLAIN_TEXT
A plain text string to be encoded.- See Also:
- Constant Field Values
-
ENCODED_TEXT
private static final String ENCODED_TEXT
Base32 encoded version ofPLAIN_TEXT.- See Also:
- Constant Field Values
-
INVALID_BASE32_TRAILING
private static final String INVALID_BASE32_TRAILING
Invalid base32 string as it has invalid trailing digits. Correctly fails with commons-codec 1.14 and greater.- See Also:
- CODEC-270, Constant Field Values
-
INVALID_BASE32
private static final String INVALID_BASE32
Invalid base32, should not produce a result.- See Also:
- Constant Field Values
-
-
Method Detail
-
testDecodeInvalidInput
public void testDecodeInvalidInput() throws DecodingExceptionTest that an invalid base32 input string does not return a response, instead throwing aDecodingException.- Throws:
DecodingException- when base32 decoding fails, expected.
-
testDecodeInvalidTrailingBitsInput
public void testDecodeInvalidTrailingBitsInput() throws DecodingExceptionTest that when the last encoded character (before the paddings if any) is a valid base 32 alphabet but not a possible value anDecodingExceptionis thrown.- Throws:
DecodingException- when base32 decoding fails
-
testEncodeNullInput
public void testEncodeNullInput() throws EncodingExceptionTest a null byte array argument violates the method contract and throws aConstraintViolationException.- Throws:
EncodingException- on encoding failure.
-
testEncode
public void testEncode() throws EncodingExceptionTest encoding a byte array works.- Throws:
EncodingException- if there is an issue encoding the byte array, should not happen.
-
-