1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.codec.language;
19
20 import static org.junit.jupiter.api.Assertions.assertFalse;
21 import static org.junit.jupiter.api.Assertions.assertTrue;
22
23 import org.apache.commons.codec.AbstractStringEncoderTest;
24 import org.apache.commons.codec.EncoderException;
25 import org.junit.jupiter.api.Test;
26
27
28
29
30 public class Caverphone1Test extends AbstractStringEncoderTest<Caverphone1> {
31
32 @Override
33 protected Caverphone1 createStringEncoder() {
34 return new Caverphone1();
35 }
36
37
38
39
40
41
42
43
44 @Test
45 public void testCaverphoneRevisitedCommonCodeAT1111() throws EncoderException {
46 this.checkEncodingVariations("AT1111", new String[]{
47 "add",
48 "aid",
49 "at",
50 "art",
51 "eat",
52 "earth",
53 "head",
54 "hit",
55 "hot",
56 "hold",
57 "hard",
58 "heart",
59 "it",
60 "out",
61 "old"});
62 }
63
64 @Test
65 public void testEndMb() throws EncoderException {
66 final String[][] data = {{"mb", "M11111"}, {"mbmb", "MPM111"}};
67 this.checkEncodings(data);
68 }
69
70
71
72
73
74
75 @Test
76 public void testIsCaverphoneEquals() throws EncoderException {
77 final Caverphone1 caverphone = new Caverphone1();
78 assertFalse(caverphone.isEncodeEqual("Peter", "Stevenson"), "Caverphone encodings should not be equal");
79 assertTrue(caverphone.isEncodeEqual("Peter", "Peady"), "Caverphone encodings should be equal");
80 }
81
82
83
84
85
86
87 @Test
88 public void testSpecificationV1Examples() throws EncoderException {
89 final String[][] data = {{"David", "TFT111"}, {"Whittle", "WTL111"}};
90 this.checkEncodings(data);
91 }
92
93
94
95
96
97
98 @Test
99 public void testWikipediaExamples() throws EncoderException {
100 final String[][] data = {{"Lee", "L11111"}, {"Thompson", "TMPSN1"}};
101 this.checkEncodings(data);
102 }
103
104 }