Skip to content

Commit

Permalink
CODEC-314: 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 b60bbf7 commit 0891e19
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.commons.codec.net;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;
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 @@ -105,6 +106,13 @@ public void testEncodeUnsupportedObject() {
assertThrows(EncoderException.class, () -> percentCodec.encode("test"));
}

@Test
public void testInvalidByte() {
byte[] invalid = {(byte)-1};

assertDoesNotThrow(() -> new PercentCodec(invalid, true));
}

@Test
public void testPercentEncoderDecoderWithNullOrEmptyInput() throws Exception {
final PercentCodec percentCodec = new PercentCodec(null, true);
Expand Down

0 comments on commit 0891e19

Please sign in to comment.