|
25 | 25 | import org.apache.commons.codec.StringEncoder; |
26 | 26 | import org.apache.commons.codec.StringEncoderAbstractTest; |
27 | 27 | import org.junit.Assert; |
| 28 | +import org.junit.Ignore; |
28 | 29 | import org.junit.Test; |
29 | 30 |
|
30 | 31 | /** |
|
34 | 35 | * @since 2.0 |
35 | 36 | */ |
36 | 37 | public class BeiderMorseEncoderTest extends StringEncoderAbstractTest { |
| 38 | + private void assertNotEmpty(BeiderMorseEncoder bmpm, final String value) throws EncoderException { |
| 39 | + Assert.assertFalse(value, bmpm.encode(value).equals("")); |
| 40 | + } |
| 41 | + |
37 | 42 | @Override |
38 | 43 | protected StringEncoder createStringEncoder() { |
39 | 44 | return new BeiderMorseEncoder(); |
40 | 45 | } |
41 | 46 |
|
| 47 | + @Ignore |
| 48 | + @Test |
| 49 | + public void testAsciiEncodeNotEmpty1Letter() throws EncoderException { |
| 50 | + BeiderMorseEncoder bmpm = new BeiderMorseEncoder(); |
| 51 | + bmpm.setNameType(NameType.GENERIC); |
| 52 | + bmpm.setRuleType(RuleType.APPROX); |
| 53 | + for (char c = 'a'; c <= 'z'; c++) { |
| 54 | + final String value = "" + c; |
| 55 | + final String valueU = value.toUpperCase(); |
| 56 | + assertNotEmpty(bmpm, value); |
| 57 | + assertNotEmpty(bmpm, valueU); |
| 58 | + } |
| 59 | + } |
| 60 | + |
| 61 | + @Test |
| 62 | + public void testAsciiEncodeNotEmpty2Letters() throws EncoderException { |
| 63 | + BeiderMorseEncoder bmpm = new BeiderMorseEncoder(); |
| 64 | + bmpm.setNameType(NameType.GENERIC); |
| 65 | + bmpm.setRuleType(RuleType.APPROX); |
| 66 | + for (char c1 = 'a'; c1 <= 'z'; c1++) { |
| 67 | + for (char c2 = 'a'; c2 <= 'z'; c2++) { |
| 68 | + final String value = new String(new char[] { c1, c2 }); |
| 69 | + final String valueU = value.toUpperCase(); |
| 70 | + assertNotEmpty(bmpm, value); |
| 71 | + assertNotEmpty(bmpm, valueU); |
| 72 | + } |
| 73 | + } |
| 74 | + } |
| 75 | + |
42 | 76 | @Test |
43 | 77 | public void testEncodeAtzNotEmpty() throws EncoderException { |
44 | 78 | BeiderMorseEncoder bmpm = new BeiderMorseEncoder(); |
45 | 79 | bmpm.setNameType(NameType.GENERIC); |
46 | 80 | bmpm.setRuleType(RuleType.APPROX); |
47 | 81 | String[] names = { "ácz", "átz", "Ignácz", "Ignátz", "Ignác" }; |
48 | 82 | for (String name : names) { |
49 | | - Assert.assertFalse(bmpm.encode(name).equals("")); |
| 83 | + assertNotEmpty(bmpm, name); |
50 | 84 | } |
51 | 85 | } |
52 | 86 |
|
|
0 commit comments