|
1 | 1 | package org.owasp.esapi.codecs.percent;
|
2 | 2 |
|
| 3 | +import static org.owasp.esapi.codecs.percent.PercentCodecStringTest.PERCENT_CODEC_IMMUNE; |
| 4 | + |
3 | 5 | import java.util.ArrayList;
|
4 | 6 | import java.util.Collection;
|
5 |
| -import java.util.List; |
6 | 7 |
|
7 | 8 | import org.junit.Assert;
|
8 | 9 | import org.junit.Test;
|
|
16 | 17 | *
|
17 | 18 | */
|
18 | 19 | public class PercentCodecCharacterTest extends AbstractCodecCharacterTest {
|
19 |
| - private static final char[] PERCENT_CODEC_IMMUNE; |
20 |
| - |
21 |
| - static { |
22 |
| - /* |
23 |
| - * The percent codec contains a unique immune character set which include letters and numbers that will not be |
24 |
| - * transformed. |
25 |
| - * It is being replicated here to allow the test to reasonably expect the correct state back. |
26 |
| - */ |
27 |
| - List<Character> immune = new ArrayList<>(); |
28 |
| - // 65 - 90 (capital letters) 97 - 122 lower case 48 - 57 digits |
29 |
| - // numbers |
30 |
| - for (int index = 48; index < 58; index++) { |
31 |
| - immune.add((char) index); |
32 |
| - } |
33 |
| - // letters |
34 |
| - for (int index = 65; index < 91; index++) { |
35 |
| - Character capsChar = (char) index; |
36 |
| - immune.add(capsChar); |
37 |
| - immune.add(Character.toLowerCase(capsChar)); |
38 |
| - } |
39 |
| - |
40 |
| - PERCENT_CODEC_IMMUNE = new char[immune.size()]; |
41 |
| - for (int index = 0; index < immune.size(); index++) { |
42 |
| - PERCENT_CODEC_IMMUNE[index] = immune.get(index).charValue(); |
43 |
| - } |
44 |
| - } |
45 |
| - |
46 | 20 | @Parameters(name = "{0}")
|
47 | 21 | public static Collection<Object[]> buildTests() {
|
48 | 22 | Collection<Object[]> tests = new ArrayList<>();
|
49 | 23 |
|
50 | 24 | Collection<CodecCharacterTestTuple> tuples = new ArrayList<>();
|
51 | 25 | tuples.add(newTuple("%3C", Character.valueOf('<')));
|
52 | 26 |
|
53 |
| - //CODEPOINT tuples.add(newTuple("%C4%80", Character.valueOf((char) 0x100))); |
54 | 27 | tuples.add(newTuple("%00", Character.MIN_VALUE));
|
55 | 28 | tuples.add(newTuple("%3D", '='));
|
56 | 29 | tuples.add(newTuple("%26", '&'));
|
|
0 commit comments