From 1e6544e4f1d269c0edf8b702f60d6dc866b3affa Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Tue, 9 Jul 2024 08:57:36 -0400 Subject: [PATCH] Remove redundant keywords --- .../commons/codec/language/SoundexTest.java | 178 +++++++++--------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/src/test/java/org/apache/commons/codec/language/SoundexTest.java b/src/test/java/org/apache/commons/codec/language/SoundexTest.java index 3bb2f02c9a..1fd1297fca 100644 --- a/src/test/java/org/apache/commons/codec/language/SoundexTest.java +++ b/src/test/java/org/apache/commons/codec/language/SoundexTest.java @@ -41,7 +41,7 @@ protected Soundex createStringEncoder() { @Test public void testB650() throws EncoderException { - this.checkEncodingVariations("B650", new String[]{ + checkEncodingVariations("B650", new String[]{ "BARHAM", "BARONE", "BARRON", @@ -86,42 +86,42 @@ public void testB650() throws EncoderException { @Test public void testBadCharacters() { - assertEquals("H452", this.getStringEncoder().encode("HOL>MES")); + assertEquals("H452", getStringEncoder().encode("HOL>MES")); } @Test public void testDifference() throws EncoderException { // Edge cases - assertEquals(0, this.getStringEncoder().difference(null, null)); - assertEquals(0, this.getStringEncoder().difference("", "")); - assertEquals(0, this.getStringEncoder().difference(" ", " ")); + assertEquals(0, getStringEncoder().difference(null, null)); + assertEquals(0, getStringEncoder().difference("", "")); + assertEquals(0, getStringEncoder().difference(" ", " ")); // Normal cases - assertEquals(4, this.getStringEncoder().difference("Smith", "Smythe")); - assertEquals(2, this.getStringEncoder().difference("Ann", "Andrew")); - assertEquals(1, this.getStringEncoder().difference("Margaret", "Andrew")); - assertEquals(0, this.getStringEncoder().difference("Janet", "Margaret")); + assertEquals(4, getStringEncoder().difference("Smith", "Smythe")); + assertEquals(2, getStringEncoder().difference("Ann", "Andrew")); + assertEquals(1, getStringEncoder().difference("Margaret", "Andrew")); + assertEquals(0, getStringEncoder().difference("Janet", "Margaret")); // Examples from https://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_de-dz_8co5.asp - assertEquals(4, this.getStringEncoder().difference("Green", "Greene")); - assertEquals(0, this.getStringEncoder().difference("Blotchet-Halls", "Greene")); + assertEquals(4, getStringEncoder().difference("Green", "Greene")); + assertEquals(0, getStringEncoder().difference("Blotchet-Halls", "Greene")); // Examples from https://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_setu-sus_3o6w.asp - assertEquals(4, this.getStringEncoder().difference("Smith", "Smythe")); - assertEquals(4, this.getStringEncoder().difference("Smithers", "Smythers")); - assertEquals(2, this.getStringEncoder().difference("Anothers", "Brothers")); + assertEquals(4, getStringEncoder().difference("Smith", "Smythe")); + assertEquals(4, getStringEncoder().difference("Smithers", "Smythers")); + assertEquals(2, getStringEncoder().difference("Anothers", "Brothers")); } @Test public void testEncodeBasic() { - assertEquals("T235", this.getStringEncoder().encode("testing")); - assertEquals("T000", this.getStringEncoder().encode("The")); - assertEquals("Q200", this.getStringEncoder().encode("quick")); - assertEquals("B650", this.getStringEncoder().encode("brown")); - assertEquals("F200", this.getStringEncoder().encode("fox")); - assertEquals("J513", this.getStringEncoder().encode("jumped")); - assertEquals("O160", this.getStringEncoder().encode("over")); - assertEquals("T000", this.getStringEncoder().encode("the")); - assertEquals("L200", this.getStringEncoder().encode("lazy")); - assertEquals("D200", this.getStringEncoder().encode("dogs")); + assertEquals("T235", getStringEncoder().encode("testing")); + assertEquals("T000", getStringEncoder().encode("The")); + assertEquals("Q200", getStringEncoder().encode("quick")); + assertEquals("B650", getStringEncoder().encode("brown")); + assertEquals("F200", getStringEncoder().encode("fox")); + assertEquals("J513", getStringEncoder().encode("jumped")); + assertEquals("O160", getStringEncoder().encode("over")); + assertEquals("T000", getStringEncoder().encode("the")); + assertEquals("L200", getStringEncoder().encode("lazy")); + assertEquals("D200", getStringEncoder().encode("dogs")); } /** @@ -129,22 +129,22 @@ public void testEncodeBasic() { */ @Test public void testEncodeBatch2() { - assertEquals("A462", this.getStringEncoder().encode("Allricht")); - assertEquals("E166", this.getStringEncoder().encode("Eberhard")); - assertEquals("E521", this.getStringEncoder().encode("Engebrethson")); - assertEquals("H512", this.getStringEncoder().encode("Heimbach")); - assertEquals("H524", this.getStringEncoder().encode("Hanselmann")); - assertEquals("H431", this.getStringEncoder().encode("Hildebrand")); - assertEquals("K152", this.getStringEncoder().encode("Kavanagh")); - assertEquals("L530", this.getStringEncoder().encode("Lind")); - assertEquals("L222", this.getStringEncoder().encode("Lukaschowsky")); - assertEquals("M235", this.getStringEncoder().encode("McDonnell")); - assertEquals("M200", this.getStringEncoder().encode("McGee")); - assertEquals("O155", this.getStringEncoder().encode("Opnian")); - assertEquals("O155", this.getStringEncoder().encode("Oppenheimer")); - assertEquals("R355", this.getStringEncoder().encode("Riedemanas")); - assertEquals("Z300", this.getStringEncoder().encode("Zita")); - assertEquals("Z325", this.getStringEncoder().encode("Zitzmeinn")); + assertEquals("A462", getStringEncoder().encode("Allricht")); + assertEquals("E166", getStringEncoder().encode("Eberhard")); + assertEquals("E521", getStringEncoder().encode("Engebrethson")); + assertEquals("H512", getStringEncoder().encode("Heimbach")); + assertEquals("H524", getStringEncoder().encode("Hanselmann")); + assertEquals("H431", getStringEncoder().encode("Hildebrand")); + assertEquals("K152", getStringEncoder().encode("Kavanagh")); + assertEquals("L530", getStringEncoder().encode("Lind")); + assertEquals("L222", getStringEncoder().encode("Lukaschowsky")); + assertEquals("M235", getStringEncoder().encode("McDonnell")); + assertEquals("M200", getStringEncoder().encode("McGee")); + assertEquals("O155", getStringEncoder().encode("Opnian")); + assertEquals("O155", getStringEncoder().encode("Oppenheimer")); + assertEquals("R355", getStringEncoder().encode("Riedemanas")); + assertEquals("Z300", getStringEncoder().encode("Zita")); + assertEquals("Z325", getStringEncoder().encode("Zitzmeinn")); } /** @@ -152,15 +152,15 @@ public void testEncodeBatch2() { */ @Test public void testEncodeBatch3() { - assertEquals("W252", this.getStringEncoder().encode("Washington")); - assertEquals("L000", this.getStringEncoder().encode("Lee")); - assertEquals("G362", this.getStringEncoder().encode("Gutierrez")); - assertEquals("P236", this.getStringEncoder().encode("Pfister")); - assertEquals("J250", this.getStringEncoder().encode("Jackson")); - assertEquals("T522", this.getStringEncoder().encode("Tymczak")); + assertEquals("W252", getStringEncoder().encode("Washington")); + assertEquals("L000", getStringEncoder().encode("Lee")); + assertEquals("G362", getStringEncoder().encode("Gutierrez")); + assertEquals("P236", getStringEncoder().encode("Pfister")); + assertEquals("J250", getStringEncoder().encode("Jackson")); + assertEquals("T522", getStringEncoder().encode("Tymczak")); // For VanDeusen: D-250 (D, 2 for the S, 5 for the N, 0 added) is also // possible. - assertEquals("V532", this.getStringEncoder().encode("VanDeusen")); + assertEquals("V532", getStringEncoder().encode("VanDeusen")); } /** @@ -168,20 +168,20 @@ public void testEncodeBatch3() { */ @Test public void testEncodeBatch4() { - assertEquals("H452", this.getStringEncoder().encode("HOLMES")); - assertEquals("A355", this.getStringEncoder().encode("ADOMOMI")); - assertEquals("V536", this.getStringEncoder().encode("VONDERLEHR")); - assertEquals("B400", this.getStringEncoder().encode("BALL")); - assertEquals("S000", this.getStringEncoder().encode("SHAW")); - assertEquals("J250", this.getStringEncoder().encode("JACKSON")); - assertEquals("S545", this.getStringEncoder().encode("SCANLON")); - assertEquals("S532", this.getStringEncoder().encode("SAINTJOHN")); + assertEquals("H452", getStringEncoder().encode("HOLMES")); + assertEquals("A355", getStringEncoder().encode("ADOMOMI")); + assertEquals("V536", getStringEncoder().encode("VONDERLEHR")); + assertEquals("B400", getStringEncoder().encode("BALL")); + assertEquals("S000", getStringEncoder().encode("SHAW")); + assertEquals("J250", getStringEncoder().encode("JACKSON")); + assertEquals("S545", getStringEncoder().encode("SCANLON")); + assertEquals("S532", getStringEncoder().encode("SAINTJOHN")); } @Test public void testEncodeIgnoreApostrophes() throws EncoderException { - this.checkEncodingVariations("O165", new String[]{ + checkEncodingVariations("O165", new String[]{ "OBrien", "'OBrien", "O'Brien", @@ -198,7 +198,7 @@ public void testEncodeIgnoreApostrophes() throws EncoderException { * @throws EncoderException for some failure scenarios */ @Test public void testEncodeIgnoreHyphens() throws EncoderException { - this.checkEncodingVariations("K525", new String[]{ + checkEncodingVariations("K525", new String[]{ "KINGSMITH", "-KINGSMITH", "K-INGSMITH", @@ -214,7 +214,7 @@ public void testEncodeIgnoreHyphens() throws EncoderException { @Test public void testEncodeIgnoreTrimmable() { - assertEquals("W252", this.getStringEncoder().encode(" \t\n\r Washington \t\n\r ")); + assertEquals("W252", getStringEncoder().encode(" \t\n\r Washington \t\n\r ")); } @Test @@ -240,10 +240,10 @@ public void testHWRuleEx1() { // http://www.archives.gov/research_room/genealogy/census/soundex.html: // Ashcraft is coded A-261 (A, 2 for the S, C ignored, 6 for the R, 1 // for the F). It is not coded A-226. - assertEquals("A261", this.getStringEncoder().encode("Ashcraft")); - assertEquals("A261", this.getStringEncoder().encode("Ashcroft")); - assertEquals("Y330", this.getStringEncoder().encode("yehudit")); - assertEquals("Y330", this.getStringEncoder().encode("yhwdyt")); + assertEquals("A261", getStringEncoder().encode("Ashcraft")); + assertEquals("A261", getStringEncoder().encode("Ashcroft")); + assertEquals("Y330", getStringEncoder().encode("yehudit")); + assertEquals("Y330", getStringEncoder().encode("yhwdyt")); } /** @@ -253,8 +253,8 @@ public void testHWRuleEx1() { */ @Test public void testHWRuleEx2() { - assertEquals("B312", this.getStringEncoder().encode("BOOTHDAVIS")); - assertEquals("B312", this.getStringEncoder().encode("BOOTH-DAVIS")); + assertEquals("B312", getStringEncoder().encode("BOOTHDAVIS")); + assertEquals("B312", getStringEncoder().encode("BOOTH-DAVIS")); } /** @@ -263,10 +263,10 @@ public void testHWRuleEx2() { * @throws EncoderException for some failure scenarios */ @Test public void testHWRuleEx3() throws EncoderException { - assertEquals("S460", this.getStringEncoder().encode("Sgler")); - assertEquals("S460", this.getStringEncoder().encode("Swhgler")); + assertEquals("S460", getStringEncoder().encode("Sgler")); + assertEquals("S460", getStringEncoder().encode("Swhgler")); // Also S460: - this.checkEncodingVariations("S460", new String[]{ + checkEncodingVariations("S460", new String[]{ "SAILOR", "SALYER", "SAYLOR", @@ -291,8 +291,8 @@ public void testHWRuleEx3() throws EncoderException { */ @Test public void testMsSqlServer1() { - assertEquals("S530", this.getStringEncoder().encode("Smith")); - assertEquals("S530", this.getStringEncoder().encode("Smythe")); + assertEquals("S530", getStringEncoder().encode("Smith")); + assertEquals("S530", getStringEncoder().encode("Smythe")); } /** @@ -303,7 +303,7 @@ public void testMsSqlServer1() { * @throws EncoderException for some failure scenarios */ @Test public void testMsSqlServer2() throws EncoderException { - this.checkEncodingVariations("E625", new String[]{"Erickson", "Erickson", "Erikson", "Ericson", "Ericksen", "Ericsen"}); + checkEncodingVariations("E625", new String[]{"Erickson", "Erickson", "Erikson", "Ericson", "Ericksen", "Ericsen"}); } /** @@ -311,15 +311,15 @@ public void testMsSqlServer2() throws EncoderException { */ @Test public void testMsSqlServer3() { - assertEquals("A500", this.getStringEncoder().encode("Ann")); - assertEquals("A536", this.getStringEncoder().encode("Andrew")); - assertEquals("J530", this.getStringEncoder().encode("Janet")); - assertEquals("M626", this.getStringEncoder().encode("Margaret")); - assertEquals("S315", this.getStringEncoder().encode("Steven")); - assertEquals("M240", this.getStringEncoder().encode("Michael")); - assertEquals("R163", this.getStringEncoder().encode("Robert")); - assertEquals("L600", this.getStringEncoder().encode("Laura")); - assertEquals("A500", this.getStringEncoder().encode("Anne")); + assertEquals("A500", getStringEncoder().encode("Ann")); + assertEquals("A536", getStringEncoder().encode("Andrew")); + assertEquals("J530", getStringEncoder().encode("Janet")); + assertEquals("M626", getStringEncoder().encode("Margaret")); + assertEquals("S315", getStringEncoder().encode("Steven")); + assertEquals("M240", getStringEncoder().encode("Michael")); + assertEquals("R163", getStringEncoder().encode("Robert")); + assertEquals("L600", getStringEncoder().encode("Laura")); + assertEquals("A500", getStringEncoder().encode("Anne")); } /** @@ -383,12 +383,12 @@ public void testUsEnglishStatic() { */ @Test public void testUsMappingEWithAcute() { - assertEquals("E000", this.getStringEncoder().encode("e")); + assertEquals("E000", getStringEncoder().encode("e")); if (Character.isLetter('\u00e9')) { // e-acute // uppercase E-acute assertThrows(IllegalArgumentException.class, () -> getStringEncoder().encode("\u00e9")); } else { - assertEquals("", this.getStringEncoder().encode("\u00e9")); + assertEquals("", getStringEncoder().encode("\u00e9")); } } @@ -399,12 +399,12 @@ public void testUsMappingEWithAcute() { */ @Test public void testUsMappingOWithDiaeresis() { - assertEquals("O000", this.getStringEncoder().encode("o")); + assertEquals("O000", getStringEncoder().encode("o")); if (Character.isLetter('\u00f6')) { // o-umlaut // uppercase O-umlaut assertThrows(IllegalArgumentException.class, () -> getStringEncoder().encode("\u00f6")); } else { - assertEquals("", this.getStringEncoder().encode("\u00f6")); + assertEquals("", getStringEncoder().encode("\u00f6")); } } @@ -413,11 +413,11 @@ public void testUsMappingOWithDiaeresis() { */ @Test public void testWikipediaAmericanSoundex() { - assertEquals("R163", this.getStringEncoder().encode("Robert")); - assertEquals("R163", this.getStringEncoder().encode("Rupert")); - assertEquals("A261", this.getStringEncoder().encode("Ashcraft")); - assertEquals("A261", this.getStringEncoder().encode("Ashcroft")); - assertEquals("T522", this.getStringEncoder().encode("Tymczak")); - assertEquals("P236", this.getStringEncoder().encode("Pfister")); + assertEquals("R163", getStringEncoder().encode("Robert")); + assertEquals("R163", getStringEncoder().encode("Rupert")); + assertEquals("A261", getStringEncoder().encode("Ashcraft")); + assertEquals("A261", getStringEncoder().encode("Ashcroft")); + assertEquals("T522", getStringEncoder().encode("Tymczak")); + assertEquals("P236", getStringEncoder().encode("Pfister")); } }