ColumnListEditor implements IsWidget, org.dashbuilder.dataset.client.editor.ColumnListEditor { @Override public void onValueUnRestricted(final String value) { this.restrictedColumns.remove(value); if (listEditor.getList().size() == 1) { setEditorEnabled(0 ,false, DataSetEditorConstants.INSTANCE.dataSetMustHaveAtLeastOneColumn()); } else { setEditorEnabled(value, true, null); } } @Inject  ColumnListEditor(final SyncBeanManager beanManager,
                            final DataColumnDefDriver dataColumnDefDriver,
                            final Event<ColumnsChangedEvent> columnsChangedEvent,
                            final View view); @PostConstruct void init(); @Override Widget asWidget(); @Override void setAcceptableValues(final List<DataColumnDef> acceptableValues); @Override void onValueRestricted(final String value); @Override void onValueUnRestricted(final String value); @Override void setProviderType(final DataSetProviderType type); void clear(); @Override DataColumnDefEditor createEditorForTraversal(); @Override String getPathElement(final DataColumnDefEditor subEditor); @Override void setEditorChain(final EditorChain<DataColumnDef, DataColumnDefEditor> chain); @Override void setDelegate(final EditorDelegate<List<DataColumnDef>> delegate); @Override void showErrors(final List<EditorError> errors); @Override void flush(); @Override void onPropertyChange(final String... paths); @Override void setValue(final List<DataColumnDef> value); public View view; }
@Test public void testOnValueUnRestricted() { final String value = "col1"; presenter.restrictedColumns.add("col1"); final DataColumnDef col2 = mock(DataColumnDef.class); when(col2.getId()).thenReturn("col2"); when(col2.getColumnType()).thenReturn(ColumnType.LABEL); presenter.listEditor.getList().add(col2); presenter.onValueUnRestricted(value); assertTrue(presenter.restrictedColumns.isEmpty()); verify(dataColumnDefEditor, times(1)).isEditMode(true); verify(view, times(1)).insert(anyInt(), any(DataColumnDefEditor.View.class), anyBoolean(), anyBoolean(), anyString()); verify(view, times(1)).remove(anyInt()); verify(view, times(0)).init(presenter); verify(view, times(0)).clear(); }