TableDisplayerView extends AbstractGwtDisplayerView<TableDisplayer> implements TableDisplayer.View { protected void setupToolbar() { HasWidgets rightToolbar = table.getRightToolbar(); if (rightToolbar instanceof HorizontalPanel) { ((HorizontalPanel) rightToolbar).insert(exportToCsvButton, 0); ((HorizontalPanel) rightToolbar).insert(exportToXlsButton, 1); } else { rightToolbar.add(exportToCsvButton); rightToolbar.add(exportToXlsButton); } }  @Override void init(TableDisplayer presenter); @Override void showTitle(String title); @Override String getGroupsTitle(); @Override String getColumnsTitle(); @Override void createTable(int pageSize, FilterLabelSet filterLabelSet); @Override void redrawTable(); @Override void setWidth(int width); @Override void setSortEnabled(boolean enabled); @Override void setTotalRows(int rows, boolean isExact); @Override void setPagerEnabled(boolean enabled); @Override void setColumnPickerEnabled(boolean enabled); @Override void setExportToCsvEnabled(boolean enabled); @Override void setExportToXlsEnabled(boolean enabled); @Override void addColumn(ColumnType columnType, String columnId, String columnName, int index, boolean selectEnabled, boolean sortEnabled); @Override void gotoFirstPage(); @Override int getLastOffset(); @Override int getPageSize(); @Override void exportNoData(); @Override void exportTooManyRows(int rowNum, int limit); @Override void exportFileUrl(String url);  }
@Test public void testCreateTableUsingHorizontalPanel() { final HorizontalPanel panel = mock(HorizontalPanel.class); when(table.getRightToolbar()).thenReturn(panel); tableDisplayerView.setupToolbar(); verify(panel).insert(any(), eq(0)); verify(panel).insert(any(), eq(1)); }