KiePMMLPredicateFactory { public static Map<String, String> getPredicateSourcesMap(final KiePMMLPredicate kiePMMLPredicate, final String packageName) { logger.trace("getPredicateSourcesMap {}", kiePMMLPredicate); if (kiePMMLPredicate instanceof KiePMMLSimplePredicate) { return getKiePMMLSimplePredicateSourcesMap((KiePMMLSimplePredicate) kiePMMLPredicate, packageName); } else if (kiePMMLPredicate instanceof KiePMMLSimpleSetPredicate) { return getKiePMMLSimpleSetPredicateSourcesMap((KiePMMLSimpleSetPredicate) kiePMMLPredicate, packageName); } else if (kiePMMLPredicate instanceof KiePMMLCompoundPredicate) { return getKiePMMLCompoundPredicateSourcesMap((KiePMMLCompoundPredicate) kiePMMLPredicate, packageName); } else if (kiePMMLPredicate instanceof KiePMMLTruePredicate) { return getKiePMMLTruePredicateSourcesMap((KiePMMLTruePredicate) kiePMMLPredicate, packageName); } else if (kiePMMLPredicate instanceof KiePMMLFalsePredicate) { return getKiePMMLFalsePredicateSourcesMap((KiePMMLFalsePredicate) kiePMMLPredicate, packageName); } else { throw new KiePMMLException("Predicate of type " + kiePMMLPredicate.getClass().getName() + " not managed, " + "yet"); } } private  KiePMMLPredicateFactory(); static List<KiePMMLPredicate> getPredicates(List<Predicate> predicates, DataDictionary dataDictionary); static KiePMMLPredicate getPredicate(Predicate predicate, DataDictionary dataDictionary); static KiePMMLSimplePredicate getKiePMMLSimplePredicate(SimplePredicate predicate, DataType dataType); static KiePMMLSimpleSetPredicate getKiePMMLSimpleSetPredicate(SimpleSetPredicate predicate); static KiePMMLCompoundPredicate getKiePMMLCompoundPredicate(CompoundPredicate predicate,
                                                                       DataDictionary dataDictionary); static KiePMMLTruePredicate getKiePMMLTruePredicate(); static KiePMMLFalsePredicate getKiePMMLFalsePredicate(); static Map<String, String> getPredicateSourcesMap(final KiePMMLPredicate kiePMMLPredicate,
                                                             final String packageName);  }
@Test public void getPredicateSourcesMap() { String packageName = "PACKAGENAME"; String predicateName = "PREDICATENAME"; KiePMMLPredicate kiePMMLPredicate = KiePMMLSimplePredicate .builder(predicateName, Collections.emptyList(), OPERATOR.GREATER_OR_EQUAL) .withValue(24) .build(); Map<String, String> retrieved = KiePMMLPredicateFactory.getPredicateSourcesMap(kiePMMLPredicate, packageName); commonVerifySourceMap(retrieved, packageName, getSanitizedClassName(kiePMMLPredicate.getId()), 1); kiePMMLPredicate = KiePMMLCompoundPredicate.builder(Collections.emptyList(), BOOLEAN_OPERATOR.OR).build(); retrieved = KiePMMLPredicateFactory.getPredicateSourcesMap(kiePMMLPredicate, packageName); commonVerifySourceMap(retrieved, packageName, getSanitizedClassName(kiePMMLPredicate.getId()), 1); kiePMMLPredicate = KiePMMLTruePredicate.builder(Collections.emptyList()).build(); retrieved = KiePMMLPredicateFactory.getPredicateSourcesMap(kiePMMLPredicate, packageName); commonVerifySourceMap(retrieved, packageName, getSanitizedClassName(kiePMMLPredicate.getId()), 1); kiePMMLPredicate = KiePMMLFalsePredicate.builder(Collections.emptyList()).build(); retrieved = KiePMMLPredicateFactory.getPredicateSourcesMap(kiePMMLPredicate, packageName); commonVerifySourceMap(retrieved, packageName, getSanitizedClassName(kiePMMLPredicate.getId()), 1); }