protected void declareRuleFromAttribute(final Attribute attribute, final String parentPath,
                                            final int attributeIndex,
                                            final List<KiePMMLDroolsRule> rules,
                                            final String statusToSet,
                                            final String characteristicReasonCode,
                                            final Number characteristicBaselineScore,
                                            final boolean isLastCharacteristic) {
        logger.trace("declareRuleFromAttribute {} {}", attribute, parentPath);
        final Predicate predicate = attribute.getPredicate();
        // This means the rule should not be created at all.
        // Different semantics has to be implemented if the "False"/"True" predicates are declared inside
        // an XOR compound predicate
        if (predicate instanceof False) {
            return;
        }
        String currentRule = String.format(PATH_PATTERN, parentPath, attributeIndex);
        KiePMMLReasonCodeAndValue reasonCodeAndValue = getKiePMMLReasonCodeAndValue(attribute, characteristicReasonCode, characteristicBaselineScore);
        PredicateASTFactoryData predicateASTFactoryData = new PredicateASTFactoryData(predicate, outputFields, rules, parentPath, currentRule, fieldTypeMap);
        KiePMMLPredicateASTFactory.factory(predicateASTFactoryData).declareRuleFromPredicate(attribute.getPartialScore(), statusToSet, reasonCodeAndValue, isLastCharacteristic);
    }
@Test
    void declareRuleFromAttributeWithSimplePredicateLastCharacteristic() {
        Attribute attribute = getSimplePredicateAttribute();
        final String parentPath = "parent_path";
        final int attributeIndex = 2;
        final List<KiePMMLDroolsRule> rules = new ArrayList<>();
        final String statusToSet = "status_to_set";
        final String characteristicReasonCode = "REASON_CODE";
        final double characteristicBaselineScore = 12;
        final boolean isLastCharacteristic = true;
        getKiePMMLScorecardModelCharacteristicASTFactory()
                .declareRuleFromAttribute(attribute, parentPath, attributeIndex, rules, statusToSet, characteristicReasonCode, characteristicBaselineScore, isLastCharacteristic);
        assertThat(rules).hasSize(1);
        commonValidateRule(rules.get(0),
                attribute,
                statusToSet,
                parentPath,
                attributeIndex,
                isLastCharacteristic,
                1,
                null,
                BOOLEAN_OPERATOR.AND,
                "value <= 5.0",
                1);
    }