ExtendedPagedTable extends PagedTable<T> { public boolean isAllItemsSelected() { if (getVisibleItemCount() == 0) { return false; } else { return StreamSupport.stream(getVisibleItems().spliterator(), false).allMatch(item -> isItemSelected(item)); } } ExtendedPagedTable(final GridGlobalPreferences gridPreferences); void setTooltip(int row,
                           int column,
                           String description); int getKeyboardSelectedColumn(); int getKeyboardSelectedRow(); int getColumnCount(); void removeColumn(Column<T, ?> col); void removeColumnMeta(ColumnMeta<T> columnMeta); Collection<ColumnMeta<T>> getColumnMetaList(); void addSelectionIgnoreColumn(Column<T, ?> column); boolean removeSelectionIgnoreColumn(Column<T, ?> column); boolean isSelectionIgnoreColumn(int colIx); List<T> getSelectedItems(); boolean isItemSelected(T item); boolean hasSelectedItems(); void deselectAllItems(); void selectAllItems(); void updateSelectedColumnRow(final Integer row,
                                        final T object,
                                        final Boolean value); boolean isAllItemsSelected(); void setSelectionCallback(final Consumer<T> selectionCallback); void setItemSelection(final T item,
                                 final Boolean newValue);  }
@Test public void testIsAllItemsSelected() { final GenericSummary gs = mock(GenericSummary.class); final List<GenericSummary> list1 = emptyList(); final List<GenericSummary> list2 = asList(gs, gs); final List<GenericSummary> list3 = singletonList(gs); when(dataGrid.getVisibleItemCount()).thenReturn(list1.size(), list2.size(), list3.size()); when(dataGrid.getVisibleItems()).thenReturn(list2, list3); assertFalse(table.isAllItemsSelected()); table.setItemSelection(gs, true); assertTrue(table.isAllItemsSelected()); table.setItemSelection(gs, false); assertFalse(table.isAllItemsSelected()); }