Skip to content

Commit

Permalink
CODEC-313: Add unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
  • Loading branch information
arthurscchan committed Nov 22, 2023
1 parent 30a1bde commit 4769376
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.commons.codec.net;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
Expand Down Expand Up @@ -227,6 +228,14 @@ public void testSoftLineBreakEncode() throws Exception {
assertEquals(qpdata, qpcodec.encode(decoded));
}

@Test
public void testTooShortByteArray() {
final QuotedPrintableCodec qpcodec = new QuotedPrintableCodec(true);
final byte[] byteArray = {(byte)0, (byte)0};

assertDoesNotThrow(() -> qpcodec.encode(byteArray));
}

@Test
public void testTrailingSpecial() throws Exception {
final QuotedPrintableCodec qpcodec = new QuotedPrintableCodec(true);
Expand Down

0 comments on commit 4769376

Please sign in to comment.