SoundexMatcher extends AbstractAttributeMatcher { @Override public double getWeight(String str1, String str2) { try { int diff = soundex.difference(str1, str2); return diff / MAX; } catch (Exception e) { LOG.warn(e.getMessage(), e); return 0; } }  @Override double getWeight(String str1, String str2); @Override AttributeMatcherType getMatchType();  }
@Test public void testGetWeight() { SoundexMatcher soundexMatcher = new SoundexMatcher(); String a = "John"; String b = "Jon"; double matchingWeight = soundexMatcher.getMatchingWeight(a, b); assertEquals(1.0d, matchingWeight, EPSILON); a = "\n"; b = "Hulme"; matchingWeight = soundexMatcher.getMatchingWeight(a, b); assertTrue("input strings are not the same " + a + " and " + b, 0.0d == matchingWeight); }