Search in sources :

Example 1 with BeforeEnterHandler

use of com.vaadin.flow.router.internal.BeforeEnterHandler in project flow by vaadin.

the class UITest method before_enter_listener_priority_should_dictate_sort_order.

@Test
public void before_enter_listener_priority_should_dictate_sort_order() throws InvalidRouteConfigurationException {
    UI ui = createTestUI();
    initUI(ui, "", null);
    ui.addBeforeEnterListener(new BeforeEnterListenerThird());
    ui.addBeforeEnterListener(new BeforeEnterListenerThird());
    ui.addBeforeEnterListener(new BeforeEnterListenerFirst());
    ui.addBeforeEnterListener(new BeforeEnterListenerSecond());
    final List<BeforeEnterHandler> beforeEnterListeners = ui.getNavigationListeners(BeforeEnterHandler.class);
    assertEquals(4, beforeEnterListeners.size());
    assertTrue(beforeEnterListeners.get(0) instanceof BeforeEnterListenerFirst);
    assertTrue(beforeEnterListeners.get(1) instanceof BeforeEnterListenerSecond);
    assertTrue(beforeEnterListeners.get(2) instanceof BeforeEnterListenerThird);
    assertTrue(beforeEnterListeners.get(3) instanceof BeforeEnterListenerThird);
}
Also used : MockUI(com.vaadin.tests.util.MockUI) BeforeEnterHandler(com.vaadin.flow.router.internal.BeforeEnterHandler) BootstrapHandlerTest(com.vaadin.flow.server.BootstrapHandlerTest) Test(org.junit.Test)

Aggregations

BeforeEnterHandler (com.vaadin.flow.router.internal.BeforeEnterHandler)1 BootstrapHandlerTest (com.vaadin.flow.server.BootstrapHandlerTest)1 MockUI (com.vaadin.tests.util.MockUI)1 Test (org.junit.Test)1