Ticket #17691: 17691_v2.patch

File 17691_v2.patch, 1.5 KB (added by taylor.smock, 5 years ago)

Modify the test case to be clear that one name is unnecessary while the other previously crashed and minimize the crash name to the smallest possible string (Third)

  • src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java

     
    244244            String part = "";
    245245            for (int i = 0; i < words.length; i++) {
    246246                String word = words[i];
    247                 part = name.substring(start, start + word.length());
     247                if (start + word.length() <= name.length()) {
     248                    part = name.substring(start, start + word.length());
     249                }
    248250                if (word.equalsIgnoreCase(part)) {
    249251                    break;
    250252                }
  • test/unit/org/openstreetmap/josm/data/validation/tests/SimilarNamedWaysTest.java

     
    129129        checkSimilarity("case only", "Rua Sao Joao", "Rua SAO JOAO", true);
    130130        checkSimilarity("case only", "Rue éèçàïù", "Rue EeCAIU", true);
    131131    }
     132
     133    /**
     134     * Test names that previously caused a crash
     135     */
     136    @Test
     137    public void testSimilarNamesRegression() {
     138        assertFalse(test.similaryName("Unnecessary Name", "Third"));
     139    }
    132140}