ColumnDefinitionFactory { public void generateColumnDefinition( final GuidedDecisionTableView.Presenter dtPresenter, final BaseColumn column, final Callback<String> afterGenerationCallback ) { if ( !builders.containsKey( column.getClass() ) ) { return; } final ColumnDefinitionBuilder builder = builders.get( column.getClass() ); builder.generateDefinition( dtPresenter, column, afterGenerationCallback ); } @Inject  ColumnDefinitionFactory( final Instance<ColumnDefinitionBuilder> builders ); void generateColumnDefinition( final GuidedDecisionTableView.Presenter dtPresenter,
                                          final BaseColumn column,
                                          final Callback<String> afterGenerationCallback );  }
@Test @SuppressWarnings("unchecked") public void unknownColumnTypeDoesNotTriggerBuilder() { final Callback<String> callback = mock(Callback.class); columnDefinitionFactory.generateColumnDefinition(dtPresenter, new RowNumberCol52(), callback); verify(callback, never()).callback(any(String.class)); }
@Test @SuppressWarnings("unchecked") public void knownColumnType_ConditionCol52() { final Pattern52 p = new Pattern52(); final ConditionCol52 column = new ConditionCol52(); p.getChildColumns().add(column); model.getConditions().add(p); final Callback<String> callback = mock(Callback.class); columnDefinitionFactory.generateColumnDefinition(dtPresenter, column, callback); verify(conditionCol52DefinitionBuilder, times(1)).generateDefinition(eq(dtPresenter), eq(column), any(Callback.class)); verify(callback, times(1)).callback(any(String.class)); }
@Test @SuppressWarnings("unchecked") public void knownColumnType_ActionInsertFactCol52() { final BaseColumn column = new ActionInsertFactCol52(); final Callback<String> callback = mock(Callback.class); columnDefinitionFactory.generateColumnDefinition(dtPresenter, column, callback); verify(actionInsertFactCol52DefinitionBuilder, times(1)).generateDefinition(eq(dtPresenter), eq(column), any(Callback.class)); verify(callback, times(1)).callback(any(String.class)); }
@Test @SuppressWarnings("unchecked") public void knownColumnType_ActionSetFieldCol52() { final BaseColumn column = new ActionSetFieldCol52(); final Callback<String> callback = mock(Callback.class); columnDefinitionFactory.generateColumnDefinition(dtPresenter, column, callback); verify(actionSetFieldCol52DefinitionBuilder, times(1)).generateDefinition(eq(dtPresenter), eq(column), any(Callback.class)); verify(callback, times(1)).callback(any(String.class)); }
@Test @SuppressWarnings("unchecked") public void knownColumnType_ActionRetractFactCol52() { final BaseColumn column = new ActionRetractFactCol52(); final Callback<String> callback = mock(Callback.class); columnDefinitionFactory.generateColumnDefinition(dtPresenter, column, callback); verify(actionRetractFactCol52DefinitionBuilder, times(1)).generateDefinition(eq(dtPresenter), eq(column), any(Callback.class)); verify(callback, times(1)).callback(any(String.class)); }