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);
}
Aggregations