KiePMMLDescrLhsFactory { protected void declareIfBreak(String ifBreakField, String ifBreakOperator, Object ifBreakValue) { builder.pattern(ifBreakField).id(INPUT_FIELD, false); final ConditionalBranchDescrBuilder<CEDescrBuilder<RuleDescrBuilder, AndDescr>> condBranchBuilder = builder.conditionalBranch(); condBranchBuilder.condition().constraint(String.format(INPUT_FIELD_CONDITIONAL, ifBreakOperator, ifBreakValue)); condBranchBuilder.consequence().breaking(true).name(BREAK_LABEL); } private  KiePMMLDescrLhsFactory(final CEDescrBuilder<RuleDescrBuilder, AndDescr> builder); static KiePMMLDescrLhsFactory factory(final CEDescrBuilder<RuleDescrBuilder, AndDescr> builder); void declareLhs(final KiePMMLDroolsRule rule);  }
@Test public void declareIfBreak() { String ifBreakField = "TEMPERATURE"; String ifBreakOperator = "<"; Object ifBreakValue = 24; KiePMMLDescrLhsFactory.factory(lhsBuilder).declareIfBreak(ifBreakField, ifBreakOperator, ifBreakValue); assertNotNull(lhsBuilder.getDescr()); final List<BaseDescr> descrs = lhsBuilder.getDescr().getDescrs(); assertNotNull(descrs); assertEquals(2, descrs.size()); assertTrue(descrs.get(0) instanceof PatternDescr); assertTrue(descrs.get(1) instanceof ConditionalBranchDescr); PatternDescr patternDescr = (PatternDescr) descrs.get(0); assertEquals(ifBreakField, patternDescr.getObjectType()); assertEquals(INPUT_FIELD, patternDescr.getIdentifier()); assertTrue(patternDescr.getConstraint() instanceof AndDescr); ConditionalBranchDescr conditionalBranchDescr = (ConditionalBranchDescr) descrs.get(1); String expectedCondition = String.format(INPUT_FIELD_CONDITIONAL, ifBreakOperator, ifBreakValue); assertEquals(expectedCondition, conditionalBranchDescr.getCondition().getContent()); assertTrue(conditionalBranchDescr.getConsequence().isBreaking()); assertEquals(BREAK_LABEL, conditionalBranchDescr.getConsequence().getText()); }