LimitedEntryConditionCol52DefinitionBuilder extends BaseConditionColumnDefinitionBuilder { @Override public void generateDefinition( final GuidedDecisionTableView.Presenter dtPresenter, final BaseColumn column, final Callback<String> afterGenerationCallback ) { if ( !( column instanceof LimitedEntryConditionCol52 ) ) { return; } generateConditionColumn( dtPresenter, column, afterGenerationCallback ); } @Inject  LimitedEntryConditionCol52DefinitionBuilder( 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 conditionIsNotPartOfAPattern() { final BaseColumn column = new LimitedEntryConditionCol52(); builder.generateDefinition( dtPresenter, column, ( String definition ) -> { fail( "ConditionCol52 was not part of a Pattern52 and hence should not be handled by ConditionCol52DefinitionBuilder" ); } ); }
@Test public void conditionIsPartOfAPattern() { final AtomicBoolean calledBack = new AtomicBoolean( false ); setupLimitedEntryPatternAndCondition(); builder.generateDefinition( dtPresenter, model.getExpandedColumns().get( 3 ), ( String definition ) -> { calledBack.set( true ); assertEquals( "$p : Person( name == \"Michael\" )", definition ); } ); assertTrue( calledBack.get() ); }