@Test public void testEncodeAtzNotEmpty() throws EncoderException { final BeiderMorseEncoder bmpm = createGenericApproxEncoder(); //String[] names = { "ácz", "átz", "Ignácz", "Ignátz", "Ignác" }; final String[] names = { "\u00e1cz", "\u00e1tz", "Ign\u00e1cz", "Ign\u00e1tz", "Ign\u00e1c" }; for (final String name : names) { assertNotEmpty(bmpm, name); } }
@Test public void testSpeedCheck2() throws EncoderException { final BeiderMorseEncoder bmpm = this.createGenericApproxEncoder(); final String phrase = "ItstheendoftheworldasweknowitandIfeelfine"; for (int i = 1; i <= phrase.length(); i++) { bmpm.encode(phrase.subSequence(0, i)); } }
@Test public void testSpeedCheck3() throws EncoderException { final BeiderMorseEncoder bmpm = this.createGenericApproxEncoder(); final String phrase = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"; for (int i = 1; i <= phrase.length(); i++) { bmpm.encode(phrase.subSequence(0, i)); } } }
@Test public void testAsciiEncodeNotEmpty2Letters() throws EncoderException { final BeiderMorseEncoder bmpm = createGenericApproxEncoder(); for (char c1 = 'a'; c1 <= 'z'; c1++) { for (char c2 = 'a'; c2 <= 'z'; c2++) { final String value = new String(new char[] { c1, c2 }); final String valueU = value.toUpperCase(); assertNotEmpty(bmpm, value); assertNotEmpty(bmpm, valueU); } } }
/** * Tests we do not blow up. * * @throws EncoderException */ @Test public void testAllChars() throws EncoderException { final BeiderMorseEncoder bmpm = createGenericApproxEncoder(); for (char c = Character.MIN_VALUE; c < Character.MAX_VALUE; c++) { bmpm.encode(Character.toString(c)); } }
@Test public void testAsciiEncodeNotEmpty1Letter() throws EncoderException { final BeiderMorseEncoder bmpm = createGenericApproxEncoder(); for (char c = 'a'; c <= 'z'; c++) { final String value = Character.toString(c); final String valueU = value.toUpperCase(); assertNotEmpty(bmpm, value); assertNotEmpty(bmpm, valueU); } }
/** * (Un)luckily, the worse performing test because of the data in {@link #TEST_CHARS} * * @throws EncoderException */ @Test(/* timeout = 20000L */) public void testSpeedCheck() throws EncoderException { final BeiderMorseEncoder bmpm = this.createGenericApproxEncoder(); final StringBuilder stringBuffer = new StringBuilder(); stringBuffer.append(TEST_CHARS[0]); for (int i = 0, j = 1; i < 40; i++, j++) { if (j == TEST_CHARS.length) { j = 0; } bmpm.encode(stringBuffer.toString()); stringBuffer.append(TEST_CHARS[j]); } }
/** * Tests https://issues.apache.org/jira/browse/CODEC-125?focusedCommentId=13071566&page=com.atlassian.jira.plugin.system.issuetabpanels: * comment-tabpanel#comment-13071566 * * @throws EncoderException */ @Test public void testEncodeGna() throws EncoderException { final BeiderMorseEncoder bmpm = createGenericApproxEncoder(); bmpm.encode("gna"); }
@Test(timeout = 10000L) public void testLongestEnglishSurname() throws EncoderException { final BeiderMorseEncoder bmpm = createGenericApproxEncoder(); bmpm.encode("MacGhilleseatheanaich"); }