SelectorDisplayer extends AbstractGwtDisplayer<SelectorDisplayer.View> { @Override public View getView() { return view; } SelectorDisplayer(); @Inject  SelectorDisplayer(View view); @Override View getView(); @Override DisplayerConstraints createDisplayerConstraints(); void onItemSelected(); @Override void onFilterEnabled(Displayer displayer, DataSetGroup groupOp); @Override void onFilterReset(Displayer displayer, List<DataSetGroup> groupOps);  }
@Test public void testDraw() { DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings() .dataset(EXPENSES) .group(COLUMN_DEPARTMENT) .column(COLUMN_DEPARTMENT) .column(COLUMN_ID, AggregateFunctionType.COUNT) .filterOn(false, true, false) .buildSettings(); SelectorDisplayer presenter = createSelectorDisplayer(departmentList); SelectorDisplayer.View view = presenter.getView(); presenter.draw(); verify(view).setFilterEnabled(true); verify(view).clearItems(); verify(view).showSelectHint(COLUMN_DEPARTMENT); verify(view, times(5)).addItem(anyString(), anyString(), eq(false)); verify(view, never()).showResetHint(anyString()); }
@Test public void testNoData() { DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings() .dataset(EXPENSES) .filter(COLUMN_ID, FilterFactory.isNull()) .group(COLUMN_DEPARTMENT) .column(COLUMN_DEPARTMENT) .column(COLUMN_ID, AggregateFunctionType.COUNT) .buildSettings(); SelectorDisplayer presenter = createSelectorDisplayer(departmentList); SelectorDisplayer.View view = presenter.getView(); presenter.draw(); verify(view).clearItems(); verify(view).showSelectHint(COLUMN_DEPARTMENT); verify(view, never()).addItem(anyString(), anyString(), anyBoolean()); }
@Test public void testNullNotShown() { DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings() .dataset(EXPENSES) .group(COLUMN_DEPARTMENT) .column(COLUMN_DEPARTMENT) .column(COLUMN_ID, AggregateFunctionType.COUNT) .buildSettings(); DataSet expensesDataSet = clientDataSetManager.getDataSet(EXPENSES); int column = expensesDataSet.getColumnIndex(expensesDataSet.getColumnById(COLUMN_DEPARTMENT)); expensesDataSet.setValueAt(0, column, null); SelectorDisplayer presenter = createSelectorDisplayer(departmentList); SelectorDisplayer.View view = presenter.getView(); presenter.draw(); verify(view, never()).addItem(anyString(), eq((String) null), anyBoolean()); verify(view, times(5)).addItem(anyString(), anyString(), eq(false)); }