1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.lang3.text.translate;
19
20 import static org.junit.jupiter.api.Assertions.assertEquals;
21 import static org.junit.jupiter.api.Assertions.assertTrue;
22
23 import java.util.HashSet;
24 import java.util.Set;
25
26 import org.apache.commons.lang3.AbstractLangTest;
27 import org.junit.jupiter.api.Test;
28
29
30
31
32 @Deprecated
33 class EntityArraysTest extends AbstractLangTest {
34
35 @Test
36 void testBasicApostrophe() {
37 assertEquals("'", new LookupTranslator(EntityArrays.BASIC_ESCAPE()).translate("'"));
38 assertEquals("'", new LookupTranslator(EntityArrays.BASIC_UNESCAPE()).translate("'"));
39 }
40
41 @Test
42 void testConstructorExists() {
43 new EntityArrays();
44 }
45
46
47 @Test
48 void testHTML40_EXTENDED_ESCAPE() {
49 final Set<String> col0 = new HashSet<>();
50 final Set<String> col1 = new HashSet<>();
51 final String[][] sa = EntityArrays.HTML40_EXTENDED_ESCAPE();
52 for (int i = 0; i < sa.length; i++) {
53 assertTrue(col0.add(sa[i][0]), "Already added entry 0: " + i + " " + sa[i][0]);
54 assertTrue(col1.add(sa[i][1]), "Already added entry 1: " + i + " " + sa[i][1]);
55 }
56 }
57
58
59 @Test
60 void testISO8859_1_ESCAPE() {
61 final Set<String> col0 = new HashSet<>();
62 final Set<String> col1 = new HashSet<>();
63 final String[][] sa = EntityArrays.ISO8859_1_ESCAPE();
64 boolean success = true;
65 for (int i = 0; i < sa.length; i++) {
66 final boolean add0 = col0.add(sa[i][0]);
67 final boolean add1 = col1.add(sa[i][1]);
68 if (!add0) {
69 success = false;
70 System.out.println("Already added entry 0: " + i + " " + sa[i][0] + " " + sa[i][1]);
71 }
72 if (!add1) {
73 success = false;
74 System.out.println("Already added entry 1: " + i + " " + sa[i][0] + " " + sa[i][1]);
75 }
76 }
77 assertTrue(success, "One or more errors detected");
78 }
79
80 }