@Test public void testMakeDecisionRule() { final DecisionRule rule = DecisionRuleFactory.makeDecisionRule(dtable); final List<UnaryTests> inputEntries = rule.getInputEntry(); assertThat(inputEntries.size()).isEqualTo(2); assertThat(inputEntries) .allSatisfy(unaryTests -> assertUnaryTestsText(unaryTests, DecisionTableDefaultValueUtilities.INPUT_CLAUSE_UNARY_TEST_TEXT)) .allSatisfy(unaryTests -> assertThat(unaryTests.getConstraintType()).isEqualTo(NONE)) .allSatisfy(unaryTests -> assertThat(unaryTests.getParent()).isEqualTo(rule)); final List<LiteralExpression> outputEntries = rule.getOutputEntry(); assertThat(outputEntries.size()).isEqualTo(2); assertThat(outputEntries) .allSatisfy(literalExpression -> assertLiteralExpressionText(literalExpression, DecisionTableDefaultValueUtilities.OUTPUT_CLAUSE_EXPRESSION_TEXT)) .allSatisfy(literalExpression -> assertThat(literalExpression.getParent()).isEqualTo(rule)); final List<RuleAnnotationClauseText> annotationEntries = rule.getAnnotationEntry(); assertThat(annotationEntries.size()).isEqualTo(2); assertThat(annotationEntries) .allSatisfy(clauseText -> assertAnnotationClauseText(clauseText, DecisionTableDefaultValueUtilities.RULE_ANNOTATION_CLAUSE_EXPRESSION_TEXT)) .allSatisfy(clauseText -> assertThat(clauseText.getParent()).isEqualTo(rule)); assertThat(rule.getParent()).isEqualTo(dtable); }
public static DecisionRule makeDecisionRule(final DecisionTable dtable) { final DecisionRule rule = new DecisionRule(); for (int ie = 0; ie < dtable.getInput().size(); ie++) { final UnaryTests ut = new UnaryTests(); ut.getText().setValue(DecisionTableDefaultValueUtilities.INPUT_CLAUSE_UNARY_TEST_TEXT); rule.getInputEntry().add(ut); ut.setParent(rule); } for (int oe = 0; oe < dtable.getOutput().size(); oe++) { final LiteralExpression le = new LiteralExpression(); le.getText().setValue(DecisionTableDefaultValueUtilities.OUTPUT_CLAUSE_EXPRESSION_TEXT); rule.getOutputEntry().add(le); le.setParent(rule); } for (int index = 0; index < dtable.getAnnotations().size(); index++) { final RuleAnnotationClauseText ruleAnnotationClauseText = new RuleAnnotationClauseText(); ruleAnnotationClauseText.getText().setValue(DecisionTableDefaultValueUtilities.RULE_ANNOTATION_CLAUSE_EXPRESSION_TEXT); rule.getAnnotationEntry().add(ruleAnnotationClauseText); ruleAnnotationClauseText.setParent(rule); } rule.setParent(dtable); return rule; }
DecisionRuleFactory { public static DecisionRule makeDecisionRule(final DecisionTable dtable) { final DecisionRule rule = new DecisionRule(); for (int ie = 0; ie < dtable.getInput().size(); ie++) { final UnaryTests ut = new UnaryTests(); ut.getText().setValue(DecisionTableDefaultValueUtilities.INPUT_CLAUSE_UNARY_TEST_TEXT); rule.getInputEntry().add(ut); ut.setParent(rule); } for (int oe = 0; oe < dtable.getOutput().size(); oe++) { final LiteralExpression le = new LiteralExpression(); le.getText().setValue(DecisionTableDefaultValueUtilities.OUTPUT_CLAUSE_EXPRESSION_TEXT); rule.getOutputEntry().add(le); le.setParent(rule); } for (int index = 0; index < dtable.getAnnotations().size(); index++) { final RuleAnnotationClauseText ruleAnnotationClauseText = new RuleAnnotationClauseText(); ruleAnnotationClauseText.getText().setValue(DecisionTableDefaultValueUtilities.RULE_ANNOTATION_CLAUSE_EXPRESSION_TEXT); rule.getAnnotationEntry().add(ruleAnnotationClauseText); ruleAnnotationClauseText.setParent(rule); } rule.setParent(dtable); return rule; } }
DecisionRuleFactory { public static DecisionRule makeDecisionRule(final DecisionTable dtable) { final DecisionRule rule = new DecisionRule(); for (int ie = 0; ie < dtable.getInput().size(); ie++) { final UnaryTests ut = new UnaryTests(); ut.getText().setValue(DecisionTableDefaultValueUtilities.INPUT_CLAUSE_UNARY_TEST_TEXT); rule.getInputEntry().add(ut); ut.setParent(rule); } for (int oe = 0; oe < dtable.getOutput().size(); oe++) { final LiteralExpression le = new LiteralExpression(); le.getText().setValue(DecisionTableDefaultValueUtilities.OUTPUT_CLAUSE_EXPRESSION_TEXT); rule.getOutputEntry().add(le); le.setParent(rule); } for (int index = 0; index < dtable.getAnnotations().size(); index++) { final RuleAnnotationClauseText ruleAnnotationClauseText = new RuleAnnotationClauseText(); ruleAnnotationClauseText.getText().setValue(DecisionTableDefaultValueUtilities.RULE_ANNOTATION_CLAUSE_EXPRESSION_TEXT); rule.getAnnotationEntry().add(ruleAnnotationClauseText); ruleAnnotationClauseText.setParent(rule); } rule.setParent(dtable); return rule; }  }
DecisionRuleFactory { public static DecisionRule makeDecisionRule(final DecisionTable dtable) { final DecisionRule rule = new DecisionRule(); for (int ie = 0; ie < dtable.getInput().size(); ie++) { final UnaryTests ut = new UnaryTests(); ut.getText().setValue(DecisionTableDefaultValueUtilities.INPUT_CLAUSE_UNARY_TEST_TEXT); rule.getInputEntry().add(ut); ut.setParent(rule); } for (int oe = 0; oe < dtable.getOutput().size(); oe++) { final LiteralExpression le = new LiteralExpression(); le.getText().setValue(DecisionTableDefaultValueUtilities.OUTPUT_CLAUSE_EXPRESSION_TEXT); rule.getOutputEntry().add(le); le.setParent(rule); } for (int index = 0; index < dtable.getAnnotations().size(); index++) { final RuleAnnotationClauseText ruleAnnotationClauseText = new RuleAnnotationClauseText(); ruleAnnotationClauseText.getText().setValue(DecisionTableDefaultValueUtilities.RULE_ANNOTATION_CLAUSE_EXPRESSION_TEXT); rule.getAnnotationEntry().add(ruleAnnotationClauseText); ruleAnnotationClauseText.setParent(rule); } rule.setParent(dtable); return rule; }  static DecisionRule makeDecisionRule(final DecisionTable dtable); static DecisionRule duplicateDecisionRule(final int index,
                                                     final DecisionTable dtable); }
DecisionRuleFactory { public static DecisionRule makeDecisionRule(final DecisionTable dtable) { final DecisionRule rule = new DecisionRule(); for (int ie = 0; ie < dtable.getInput().size(); ie++) { final UnaryTests ut = new UnaryTests(); ut.getText().setValue(DecisionTableDefaultValueUtilities.INPUT_CLAUSE_UNARY_TEST_TEXT); rule.getInputEntry().add(ut); ut.setParent(rule); } for (int oe = 0; oe < dtable.getOutput().size(); oe++) { final LiteralExpression le = new LiteralExpression(); le.getText().setValue(DecisionTableDefaultValueUtilities.OUTPUT_CLAUSE_EXPRESSION_TEXT); rule.getOutputEntry().add(le); le.setParent(rule); } for (int index = 0; index < dtable.getAnnotations().size(); index++) { final RuleAnnotationClauseText ruleAnnotationClauseText = new RuleAnnotationClauseText(); ruleAnnotationClauseText.getText().setValue(DecisionTableDefaultValueUtilities.RULE_ANNOTATION_CLAUSE_EXPRESSION_TEXT); rule.getAnnotationEntry().add(ruleAnnotationClauseText); ruleAnnotationClauseText.setParent(rule); } rule.setParent(dtable); return rule; }  static DecisionRule makeDecisionRule(final DecisionTable dtable); static DecisionRule duplicateDecisionRule(final int index,
                                                     final DecisionTable dtable);  }