AbstractAttributeMatcher implements IAttributeMatcher, ITokenization, Serializable { @Override public double getMatchingWeight(String string1, String string2) { String str1 = string1, str2 = string2; boolean str1IsNull = isNullOrEmpty(str1); boolean str2IsNull = isNullOrEmpty(str2); switch (nullOption) { case nullMatchAll: if (str1IsNull || str2IsNull) { return 1.0; } break; case nullMatchNone: if (str1IsNull || str2IsNull) { return 0.0; } break; case nullMatchNull: if (str1IsNull && str2IsNull) return 1.0; else if (str1IsNull || str2IsNull) return 0.0; break; default: break; } boolean isNullorEmptyStr1 = !isNullOrEmpty(str1); boolean isNullorEmptyStr2 = !isNullOrEmpty(str2); assert isNullorEmptyStr1 : "string should not be null or empty here"; assert isNullorEmptyStr2 : "string should not be null or empty here"; if (fingerPrintApply) { FingerprintKeyer fg = new FingerprintKeyer(); str1 = fg.key(str1); str2 = fg.key(str2); } return weight(str1, str2); }  @Override float getThreshold(); @Override double getWeight(); @Override double getMatchingWeight(String string1, String string2); @Override void setNullOption(NullOption option); @Override NullOption getNullOption(); @Override String getAttributeName(); boolean isFingerPrintApply(); TokenizedResolutionMethod getTokenMethod(); @Override void setAttributeName(String name); boolean isInitialComparison(); @Override void setTokenMethod(TokenizedResolutionMethod tokenMethod); void setInitialComparison(boolean initialComparison); void setRegexTokenize(String regexTokenize); void setFingerPrintApply(boolean fingerPrintApply); @Override void setNullOption(String option);  }
@Test public void testGetMatchingWeight() { for (String[] str : testcase) { AbstractAttributeMatcher matcher = (AbstractAttributeMatcher) AttributeMatcherFactory.createMatcher(str[0]); matcher.setTokenMethod(TokenizedResolutionMethod.NO); matcher.setInitialComparison(false); matcher.setFingerPrintApply(false); assertEquals("The score of test case is unexpected.\n" + Arrays.asList(str), Double.valueOf(str[3]), matcher.getMatchingWeight(str[1], str[2]), 0.01); } }