AbstractDataView implements DataView<T> { @Override public Registration addItemCountChangeListener( ComponentEventListener<ItemCountChangeEvent<?>> listener) { Objects.requireNonNull(listener, "ItemCountChangeListener cannot be null"); return ComponentUtil.addListener(component, ItemCountChangeEvent.class, (ComponentEventListener) listener); } AbstractDataView(
            SerializableSupplier<? extends DataProvider<T, ?>> dataProviderSupplier,
            Component component); @Override Registration addItemCountChangeListener(
            ComponentEventListener<ItemCountChangeEvent<?>> listener); @Override Stream<T> getItems(); @Override void refreshItem(T item); @Override void setIdentifierProvider(
            IdentifierProvider<T> identifierProvider);  }
@Test public void addItemCountChangeListener_fireEvent_listenerNotified() { AtomicInteger fired = new AtomicInteger(0); dataView.addItemCountChangeListener( event -> fired.compareAndSet(0, event.getItemCount())); ComponentUtil .fireEvent(component, new ItemCountChangeEvent<>(component, 10, false)); Assert.assertEquals(10, fired.get()); }