use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class ConditionColumnSynchronizerTest method testUpdate1.
@Test
public void testUpdate1() throws VetoException {
// Single Pattern, single Condition
final Pattern52 pattern = spy(boundApplicantPattern("$a"));
final ConditionCol52 condition = spy(ageEqualsCondition());
modelSynchronizer.appendColumn(pattern, condition);
final Pattern52 editedPattern = boundApplicantPattern("$a");
final ConditionCol52 editedCondition = nameEqualsCondition();
editedCondition.setWidth(condition.getWidth());
List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(pattern, condition, editedPattern, editedCondition);
assertEquals(2, diffs.size());
verify(pattern).diff(editedPattern);
verify(condition).diff(editedCondition);
assertEquals("header", diffs.get(0).getFieldName());
assertEquals("factField", diffs.get(1).getFieldName());
assertEquals(3, model.getExpandedColumns().size());
assertEquals(1, model.getConditions().size());
assertEquals(1, model.getConditionPattern("$a").getChildColumns().size());
assertEquals(3, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(2) instanceof StringUiColumn);
assertEquals(editedPattern.getBoundName() + " : " + editedPattern.getFactType(), uiModel.getColumns().get(2).getHeaderMetaData().get(0).getTitle());
assertEquals(editedCondition.getHeader(), uiModel.getColumns().get(2).getHeaderMetaData().get(1).getTitle());
}
Aggregations