DefaultSimilarNamesPolicy extends AbstractPolicy implements SimilarNamesPolicy { @Override public boolean isSimilarName(String original, String proposed) { return this.levenshteinDistance.apply(clean(original), clean(proposed)) >= 0; }  int getSimilarNamesDistance(); void setSimilarNamesDistance(int similarNamesDistance); @Override boolean isSimilarName(String original, String proposed); @Override String getDescription(); @Override int hashCode(); @Override boolean equals(Object obj); static final int DEFAULT_SIMILAR_NAMES_DISTANCE; }
@Test public void testIsSimilarName() { assertTrue(policy.isSimilarName("BRO", "BROADWAY")); assertTrue(policy.isSimilarName("BRODWAY", "BRODWAY")); assertTrue(policy.isSimilarName("BRODWAY", "BROADWAY")); assertTrue(policy.isSimilarName("BROAD", "BROADWAY")); assertTrue(policy.isSimilarName("BRADWAY", "BROADWAY")); assertTrue(policy.isSimilarName("ROADWAY", "BROADWAY")); assertTrue(policy.isSimilarName("100 ST", "WEST 100 STREET")); assertTrue(policy.isSimilarName("100 ST", "EAST 100 STREET")); assertTrue(policy.isSimilarName("WEST 100 AVE", "WEST 100 STREET")); assertTrue(policy.isSimilarName("EasTeRN PKWY", "EASTERN PARKWAY")); assertTrue(policy.isSimilarName("BROAD STREET", "BROADWAY")); assertTrue(policy.isSimilarName("BRODWAY", "BROAD STREET")); assertTrue(policy.isSimilarName("BRODWAY", "BROWN BOULEVARD")); assertFalse(policy.isSimilarName("BRODWAY", "WB BRIDGE APPROACH")); }