use of com.vaadin.flow.router.legacy.RouterConfiguration in project flow by vaadin.
the class RouterConfigurationTest method routeMatches.
private static boolean routeMatches(String location, String route) {
RouterConfiguration configuration = createConfiguration();
configuration.setRoute(route, createNoopHandler());
Optional<NavigationHandler> resolveRoute = configuration.resolveRoute(new Location(location));
return resolveRoute.isPresent();
}
use of com.vaadin.flow.router.legacy.RouterConfiguration in project flow by vaadin.
the class RouterConfigurationTest method testSetExistingWildcardThrows.
@Test(expected = IllegalStateException.class)
public void testSetExistingWildcardThrows() {
RouterConfiguration configuration = createConfiguration();
configuration.setRoute("foo/*", createNoopHandler());
configuration.setRoute("foo/*", createNoopHandler());
}
use of com.vaadin.flow.router.legacy.RouterConfiguration in project flow by vaadin.
the class RouterConfigurationTest method testSetExistingRouteThrows.
@Test(expected = IllegalStateException.class)
public void testSetExistingRouteThrows() {
RouterConfiguration configuration = createConfiguration();
configuration.setRoute("foo", createNoopHandler());
configuration.setRoute("foo", createNoopHandler());
}
use of com.vaadin.flow.router.legacy.RouterConfiguration in project flow by vaadin.
the class RouterConfigurationTest method testRemoveRoutes.
@Test
public void testRemoveRoutes() {
RouterConfiguration configuration = createConfiguration();
NavigationHandler navigationHandler = createNoopHandler();
configuration.setRoute("foo", navigationHandler);
configuration.setRoute("{name}", navigationHandler);
configuration.setRoute("*", navigationHandler);
configuration.removeRoute("foo");
Assert.assertNotNull(configuration.resolveRoute(new Location("foo")));
configuration.removeRoute("{otherName}");
Assert.assertNotNull(configuration.resolveRoute(new Location("foo")));
configuration.removeRoute("*");
// Should resolve to empty optional only after removing all the routes
Assert.assertFalse(configuration.resolveRoute(new Location("foo")).isPresent());
}
use of com.vaadin.flow.router.legacy.RouterConfiguration in project flow by vaadin.
the class RouterConfigurationTest method testSetParentViewTwice.
@Test
public void testSetParentViewTwice() {
RouterConfiguration configuration = createConfiguration();
configuration.setParentView(TestView.class, ParentView.class);
configuration.setParentView(TestView.class, ParentView.class);
}
Aggregations