Class DataProviderListenersTest


  • public final class DataProviderListenersTest
    extends Object
    Util class for testing how components with data provider handles the data provider listener on attaching/detaching and on setting a new data provider.
    • Method Detail

      • checkOldListenersRemovedOnComponentAttachAndDetach

        public static <C extends com.vaadin.flow.data.provider.HasListDataView<Object,​?>> void checkOldListenersRemovedOnComponentAttachAndDetach​(C component,
                                                                                                                                                        int expectedListenersCountAfterDataProviderSetup,
                                                                                                                                                        int expectedListenersCountAfterComponentAttach,
                                                                                                                                                        int[] expectedRemovedListenerIndexes,
                                                                                                                                                        com.vaadin.flow.component.UI mockUI)
        Checks the old data provider listeners of the component are removed after component attach/detach and a new ones are added.
        Type Parameters:
        C - component type
        Parameters:
        component - to be attached/detached
        expectedListenersCountAfterDataProviderSetup - expected listeners count after setting a data provider to component
        expectedListenersCountAfterComponentAttach - expected listeners count after attaching the component
        expectedRemovedListenerIndexes - indexes of listeners which are supposed to be removed after attach and detach of component, index starts from 0.
        mockUI - UI the component is attached to