use of com.vaadin.flow.router.legacy.Router in project flow by vaadin.
the class RouterConfigurationTest method testSetErrorView_nullParentView_throws.
@Test(expected = IllegalArgumentException.class)
public void testSetErrorView_nullParentView_throws() {
Router router = new Router();
router.reconfigure(conf -> conf.setErrorView(TestView.class, null));
}
use of com.vaadin.flow.router.legacy.Router in project flow by vaadin.
the class RouterConfigurationTest method customErrorViewStatusCode.
@Test
public void customErrorViewStatusCode() {
Router router = new Router();
router.reconfigure(c -> {
c.setErrorView(ParentView.class);
});
int statusCode = router.getConfiguration().getErrorHandler().handle(new NavigationEvent(router, new Location(""), new UI(), NavigationTrigger.PROGRAMMATIC));
Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, statusCode);
}
use of com.vaadin.flow.router.legacy.Router in project flow by vaadin.
the class RouterConfigurationTest method testSetNullPageTitleGenerator.
@Test(expected = IllegalArgumentException.class)
public void testSetNullPageTitleGenerator() {
Router router = new Router();
router.reconfigure(conf -> {
conf.setPageTitleGenerator(null);
});
}
use of com.vaadin.flow.router.legacy.Router in project flow by vaadin.
the class RouterConfigurationTest method getRouteMultipleMappings.
@Test(expected = IllegalArgumentException.class)
public void getRouteMultipleMappings() {
Router router = new Router();
router.reconfigure(conf -> {
conf.setRoute("route1", TestView.class);
conf.setRoute("route2", TestView.class);
});
assertRoute(router, TestView.class, "Should throw exception");
}
use of com.vaadin.flow.router.legacy.Router in project flow by vaadin.
the class RouterConfigurationTest method getRoutesAfterRemoved.
@Test
public void getRoutesAfterRemoved() {
Router router = new Router();
router.reconfigure(conf -> {
conf.setRoute("route1", TestView.class);
conf.setRoute("route2", AnotherTestView.class);
});
router.reconfigure(conf -> {
conf.removeRoute("route1");
});
assertRoutes(router, TestView.class);
assertRoutes(router, AnotherTestView.class, "route2");
}
Aggregations