Skip to content

Commit 043178c

Browse files
committed
[CODEC-240] Add Percent-Encoding Codec (described in RFC3986 and RFC7578). Add and ignore testBasicSpace().
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1814515 13f79535-47bb-0310-9956-ffa450edef68
1 parent 95083b5 commit 043178c

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@
1717

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

20+
import static org.junit.Assert.assertEquals;
21+
import static org.junit.Assert.assertTrue;
22+
2023
import java.nio.charset.Charset;
2124
import java.util.Arrays;
25+
2226
import org.apache.commons.codec.DecoderException;
2327
import org.apache.commons.codec.EncoderException;
24-
import static org.junit.Assert.assertEquals;
25-
import static org.junit.Assert.assertTrue;
28+
import org.junit.Assert;
29+
import org.junit.Ignore;
2630
import org.junit.Test;
2731

2832
/**
@@ -42,6 +46,15 @@ public void testBasicEncodeDecode() throws Exception {
4246
assertEquals("Basic PercentCodec decoding test", input, decodedS);
4347
}
4448

49+
@Test
50+
@Ignore
51+
public void testBasicSpace() throws Exception {
52+
PercentCodec percentCodec = new PercentCodec();
53+
final String input = " ";
54+
byte[] encoded = percentCodec.encode(input.getBytes(Charset.forName("UTF-8")));
55+
Assert.assertArrayEquals("%20".getBytes(Charset.forName("UTF-8")), encoded);
56+
}
57+
4558
@Test
4659
public void testSafeCharEncodeDecodeObject() throws Exception {
4760
PercentCodec percentCodec = new PercentCodec(null, true);

0 commit comments

Comments
 (0)