@Test void testCreateNumericQualityIndicatorDoesNotThrowNPE() { InternalAbstractCategoryRule rule = new NegativeCategoryRule(); Category target = mock(Category.class); when(target.getLabel()).thenReturn("label1"); Category source = mock(Category.class); when(source.getLabel()).thenReturn("label2"); rule.createCategoryMatchQuality(target, source); }
@Override public CategoryMatchQuality<Double> createCategoryMatchQuality( Category targetCategory, Category sourceCategory) { String matchedTermForTargetLabel = getMatchedTermFromTheRulelabelContainsWords(targetCategory.getLabel()); String matchedTermForSourceLabel = getMatchedTermFromTheRulelabelContainsWords(sourceCategory.getLabel()); boolean ruleApplied = StringUtils.isNotBlank(matchedTermForTargetLabel) && StringUtils.isNotBlank(matchedTermForSourceLabel); Quality<Double> quality = NumericQuality.create( createNumericQualityIndicator(matchedTermForTargetLabel, matchedTermForSourceLabel)); return CategoryMatchQuality.create(ruleApplied, quality, targetCategory, sourceCategory); }
InternalAbstractCategoryRule implements CategoryRule { @Override public CategoryMatchQuality<Double> createCategoryMatchQuality( Category targetCategory, Category sourceCategory) { String matchedTermForTargetLabel = getMatchedTermFromTheRulelabelContainsWords(targetCategory.getLabel()); String matchedTermForSourceLabel = getMatchedTermFromTheRulelabelContainsWords(sourceCategory.getLabel()); boolean ruleApplied = StringUtils.isNotBlank(matchedTermForTargetLabel) && StringUtils.isNotBlank(matchedTermForSourceLabel); Quality<Double> quality = NumericQuality.create( createNumericQualityIndicator(matchedTermForTargetLabel, matchedTermForSourceLabel)); return CategoryMatchQuality.create(ruleApplied, quality, targetCategory, sourceCategory); } }
InternalAbstractCategoryRule implements CategoryRule { @Override public CategoryMatchQuality<Double> createCategoryMatchQuality( Category targetCategory, Category sourceCategory) { String matchedTermForTargetLabel = getMatchedTermFromTheRulelabelContainsWords(targetCategory.getLabel()); String matchedTermForSourceLabel = getMatchedTermFromTheRulelabelContainsWords(sourceCategory.getLabel()); boolean ruleApplied = StringUtils.isNotBlank(matchedTermForTargetLabel) && StringUtils.isNotBlank(matchedTermForSourceLabel); Quality<Double> quality = NumericQuality.create( createNumericQualityIndicator(matchedTermForTargetLabel, matchedTermForSourceLabel)); return CategoryMatchQuality.create(ruleApplied, quality, targetCategory, sourceCategory); } InternalAbstractCategoryRule(Set<String> words); }
InternalAbstractCategoryRule implements CategoryRule { @Override public CategoryMatchQuality<Double> createCategoryMatchQuality( Category targetCategory, Category sourceCategory) { String matchedTermForTargetLabel = getMatchedTermFromTheRulelabelContainsWords(targetCategory.getLabel()); String matchedTermForSourceLabel = getMatchedTermFromTheRulelabelContainsWords(sourceCategory.getLabel()); boolean ruleApplied = StringUtils.isNotBlank(matchedTermForTargetLabel) && StringUtils.isNotBlank(matchedTermForSourceLabel); Quality<Double> quality = NumericQuality.create( createNumericQualityIndicator(matchedTermForTargetLabel, matchedTermForSourceLabel)); return CategoryMatchQuality.create(ruleApplied, quality, targetCategory, sourceCategory); } InternalAbstractCategoryRule(Set<String> words); @Override CategoryMatchQuality<Double> createCategoryMatchQuality(
      Category targetCategory, Category sourceCategory); }
InternalAbstractCategoryRule implements CategoryRule { @Override public CategoryMatchQuality<Double> createCategoryMatchQuality( Category targetCategory, Category sourceCategory) { String matchedTermForTargetLabel = getMatchedTermFromTheRulelabelContainsWords(targetCategory.getLabel()); String matchedTermForSourceLabel = getMatchedTermFromTheRulelabelContainsWords(sourceCategory.getLabel()); boolean ruleApplied = StringUtils.isNotBlank(matchedTermForTargetLabel) && StringUtils.isNotBlank(matchedTermForSourceLabel); Quality<Double> quality = NumericQuality.create( createNumericQualityIndicator(matchedTermForTargetLabel, matchedTermForSourceLabel)); return CategoryMatchQuality.create(ruleApplied, quality, targetCategory, sourceCategory); } InternalAbstractCategoryRule(Set<String> words); @Override CategoryMatchQuality<Double> createCategoryMatchQuality(
      Category targetCategory, Category sourceCategory);  }