Skip to content

Commit ad656e5

Browse files
committed
CODEC-313: Add unit test
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
1 parent d2b68eb commit ad656e5

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/test/java/org/apache/commons/codec/net/QuotedPrintableCodecTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.apache.commons.codec.net;
1919

20+
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
2021
import static org.junit.jupiter.api.Assertions.assertEquals;
2122
import static org.junit.jupiter.api.Assertions.assertNull;
2223
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -227,6 +228,15 @@ public void testSoftLineBreakEncode() throws Exception {
227228
assertEquals(qpdata, qpcodec.encode(decoded));
228229
}
229230

231+
@Test
232+
public void testTooShortByteArray() {
233+
assertDoesNotThrow(() -> {
234+
final QuotedPrintableCodec qpcodec = new QuotedPrintableCodec(true);
235+
final String qpdata = "AA";
236+
assertNull(qpcodec.encode(qpdata), "Result should be null.");
237+
});
238+
}
239+
230240
@Test
231241
public void testTrailingSpecial() throws Exception {
232242
final QuotedPrintableCodec qpcodec = new QuotedPrintableCodec(true);

0 commit comments

Comments
 (0)