@Test public void testExtractColumnData() { final DeleteRuleAnnotationClauseCommand command = mock(DeleteRuleAnnotationClauseCommand.class); doCallRealMethod().when(command).extractColumnData(); final int clauseIndex = 2; final DecisionRule rule1 = mock(DecisionRule.class); final DecisionRule rule2 = mock(DecisionRule.class); final List<DecisionRule> rules = Arrays.asList(rule1, rule2); final List rule1AnnotationEntry = mock(List.class); final List rule2AnnotationEntry = mock(List.class); final RuleAnnotationClauseText text1 = mock(RuleAnnotationClauseText.class); final RuleAnnotationClauseText text2 = mock(RuleAnnotationClauseText.class); when(command.getDecisionTable()).thenReturn(decisionTable); when(command.getRuleAnnotationClauseIndex()).thenReturn(clauseIndex); when(rule1AnnotationEntry.get(clauseIndex)).thenReturn(text1); when(rule2AnnotationEntry.get(clauseIndex)).thenReturn(text2); when(rule1.getAnnotationEntry()).thenReturn(rule1AnnotationEntry); when(rule2.getAnnotationEntry()).thenReturn(rule2AnnotationEntry); when(decisionTable.getRule()).thenReturn(rules); final List<RuleAnnotationClauseText> columnData = command.extractColumnData(); assertEquals(2, columnData.size()); assertTrue(columnData.contains(text1)); assertTrue(columnData.contains(text2)); }
List<RuleAnnotationClauseText> extractColumnData() { final int clauseIndex = getRuleAnnotationClauseIndex(); return getDecisionTable().getRule() .stream() .map(row -> row.getAnnotationEntry().get(clauseIndex)) .collect(Collectors.toList()); }
DeleteRuleAnnotationClauseCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                             VetoUndoCommand { List<RuleAnnotationClauseText> extractColumnData() { final int clauseIndex = getRuleAnnotationClauseIndex(); return getDecisionTable().getRule() .stream() .map(row -> row.getAnnotationEntry().get(clauseIndex)) .collect(Collectors.toList()); } }
DeleteRuleAnnotationClauseCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                             VetoUndoCommand { List<RuleAnnotationClauseText> extractColumnData() { final int clauseIndex = getRuleAnnotationClauseIndex(); return getDecisionTable().getRule() .stream() .map(row -> row.getAnnotationEntry().get(clauseIndex)) .collect(Collectors.toList()); } DeleteRuleAnnotationClauseCommand(final DecisionTable decisionTable,
                                             final GridData uiModel,
                                             final int uiColumnIndex,
                                             final DecisionTableUIModelMapper uiModelMapper,
                                             final org.uberfire.mvp.Command executeCanvasOperation,
                                             final org.uberfire.mvp.Command undoCanvasOperation); }
DeleteRuleAnnotationClauseCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                             VetoUndoCommand { List<RuleAnnotationClauseText> extractColumnData() { final int clauseIndex = getRuleAnnotationClauseIndex(); return getDecisionTable().getRule() .stream() .map(row -> row.getAnnotationEntry().get(clauseIndex)) .collect(Collectors.toList()); } DeleteRuleAnnotationClauseCommand(final DecisionTable decisionTable,
                                             final GridData uiModel,
                                             final int uiColumnIndex,
                                             final DecisionTableUIModelMapper uiModelMapper,
                                             final org.uberfire.mvp.Command executeCanvasOperation,
                                             final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); }
DeleteRuleAnnotationClauseCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                             VetoUndoCommand { List<RuleAnnotationClauseText> extractColumnData() { final int clauseIndex = getRuleAnnotationClauseIndex(); return getDecisionTable().getRule() .stream() .map(row -> row.getAnnotationEntry().get(clauseIndex)) .collect(Collectors.toList()); } DeleteRuleAnnotationClauseCommand(final DecisionTable decisionTable,
                                             final GridData uiModel,
                                             final int uiColumnIndex,
                                             final DecisionTableUIModelMapper uiModelMapper,
                                             final org.uberfire.mvp.Command executeCanvasOperation,
                                             final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation();  }