@Test public void unsafeDecode() throws Exception { assertEncoded("=\r\n", "=3D=0D=0A"); }
@Test public void invalidQuotedPrintableEncoding() throws Exception { assertIOException("truncated escape sequence", "YWJjMTIzXy0uKn4hQCMkJV4mKCkre31cIlxcOzpgLC9bXQ=="); }
@Test public void invalidSoftBreak1() throws Exception { assertIOException("CR must be followed by LF", "=\r\r"); }
/** * This is NOT supported by Commons-Codec, see CODEC-121. * * @throws Exception * @see <a href="https://issues.apache.org/jira/browse/CODEC-121">CODEC-121</a> */ @Test public void softLineBreakDecode() throws Exception { assertEncoded("If you believe that truth=beauty, then surely mathematics is the most beautiful branch of philosophy.", "If you believe that truth=3Dbeauty, then surely=20=\r\nmathematics is the most beautiful branch of philosophy."); }
@Test public void invalidSoftBreak2() throws Exception { assertIOException("CR must be followed by LF", "=\rn"); }
@Test public void emptyDecode() throws Exception { assertEncoded("", ""); }
@Test public void truncatedEscape() throws Exception { assertIOException("truncated", "=1"); }
@Test public void basicEncodeDecode() throws Exception { assertEncoded("= Hello there =\r\n", "=3D Hello there =3D=0D=0A"); }
@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 unsafeDecodeLowerCase() throws Exception { assertEncoded("=\r\n", "=3d=0d=0a"); }
@Test(expected = IOException.class) public void invalidCharDecode() throws Exception { assertEncoded("=\r\n", "=3D=XD=XA"); }