BRLConditionColumnDefinitionBuilder extends BaseColumnDefinitionBuilder { @Override public void generateDefinition(final GuidedDecisionTableView.Presenter dtPresenter, final BaseColumn column, final Callback<String> afterGenerationCallback) { if (!(column instanceof BRLConditionVariableColumn)) { return; } final GuidedDecisionTable52 existingModel = dtPresenter.getModel(); final BRLConditionVariableColumn brlVariableColumn = (BRLConditionVariableColumn) column; final BRLConditionColumn brlColumn = existingModel.getBRLColumn(brlVariableColumn); final GuidedDecisionTable52 partialModel = new GuidedDecisionTable52(); final ColumnUtilities columnUtilities = new ColumnUtilities(existingModel, dtPresenter.getDataModelOracle()); partialModel.getConditions().add(brlColumn); partialModel.getData().add(makeRowData(columnUtilities, brlColumn)); generateDefinitionOnServer(partialModel, dtPresenter.getCurrentPath(), (String drl) -> afterGenerationCallback.callback(getLHS(drl))); } @Inject  BRLConditionColumnDefinitionBuilder(final Caller<GuidedDecisionTableEditorService> service); @Override Class getSupportedColumnType(); @Override void generateDefinition(final GuidedDecisionTableView.Presenter dtPresenter,
                                   final BaseColumn column,
                                   final Callback<String> afterGenerationCallback);  }
@Test public void unknownColumnTypeDoesNotTriggerBuilder() { final BaseColumn column = new RowNumberCol52(); builder.generateDefinition(dtPresenter, column, (String definition) -> { fail("RowNumberCol52 should not be handled by ConditionCol52DefinitionBuilder"); }); }
@Test public void simpleBRLConditionColumn() { final AtomicBoolean calledBack = new AtomicBoolean(false); setupBRLConditionColumn(); builder.generateDefinition(dtPresenter, model.getExpandedColumns().get(3), (String definition) -> { calledBack.set(true); assertEquals("Person( name == \"x\" )<br/>" + "Smurf( colour == \"x\" )", definition); }); assertTrue(calledBack.get()); }