Author: sebb Date: Tue Mar 19 20:48:48 2013 New Revision: 1458506 URL: http://svn.apache.org/r1458506 Log: Some more tests
Modified: commons/proper/fileupload/trunk/src/test/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoderTestCase.java Modified: commons/proper/fileupload/trunk/src/test/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoderTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/test/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoderTestCase.java?rev=1458506&r1=1458505&r2=1458506&view=diff ============================================================================== --- commons/proper/fileupload/trunk/src/test/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoderTestCase.java (original) +++ commons/proper/fileupload/trunk/src/test/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoderTestCase.java Tue Mar 19 20:48:48 2013 @@ -34,13 +34,25 @@ public final class QuotedPrintableDecode private static final String US_ASCII_CHARSET = "US-ASCII"; @Test + public void emptyDecode() throws Exception { + assertEncoded("", ""); + } + + @Test + public void plainDecode() throws Exception { + // spaces are allowed in encoded data + // There are special rules for trailing spaces; these are not currently implemented. + assertEncoded("The quick brown fox jumps over the lazy dog.", "The quick brown fox jumps over the lazy dog."); + } + + @Test public void basicEncodeDecode() throws Exception { assertEncoded("= Hello there =\r\n", "=3D Hello there =3D=0D=0A"); } - @Test(expected = IOException.class) + @Test public void invalidQuotedPrintableEncoding() throws Exception { - assertEncoded("abc123_-.*~!@#$%^&()+{}\"\\;:`,/[]", "YWJjMTIzXy0uKn4hQCMkJV4mKCkre31cIlxcOzpgLC9bXQ=="); + assertIOException("truncated escape sequence", "YWJjMTIzXy0uKn4hQCMkJV4mKCkre31cIlxcOzpgLC9bXQ=="); } @Test