Search in sources :

Example 6 with RouterConfiguration

use of com.vaadin.flow.router.legacy.RouterConfiguration in project flow by vaadin.

the class RouterConfigurationTest method testSetExistingPlaceholderThrows.

@Test(expected = IllegalStateException.class)
public void testSetExistingPlaceholderThrows() {
    RouterConfiguration configuration = createConfiguration();
    configuration.setRoute("{name}", createNoopHandler());
    configuration.setRoute("{anotherName}", createNoopHandler());
}
Also used : RouterConfiguration(com.vaadin.flow.router.legacy.RouterConfiguration) Test(org.junit.Test)

Example 7 with RouterConfiguration

use of com.vaadin.flow.router.legacy.RouterConfiguration in project flow by vaadin.

the class RouterConfigurationTest method testReplaceParentViewThrows.

@Test(expected = IllegalStateException.class)
public void testReplaceParentViewThrows() {
    RouterConfiguration configuration = createConfiguration();
    configuration.setParentView(TestView.class, ParentView.class);
    configuration.setParentView(TestView.class, AnotherParentView.class);
}
Also used : RouterConfiguration(com.vaadin.flow.router.legacy.RouterConfiguration) Test(org.junit.Test)

Example 8 with RouterConfiguration

use of com.vaadin.flow.router.legacy.RouterConfiguration in project flow by vaadin.

the class RouterConfigurationTest method testEverythingIsCopied.

@Test
public void testEverythingIsCopied() throws Exception {
    RouterConfiguration original = createConfiguration();
    original.setRoute("foo/bar", TestView.class);
    original.setErrorView(TestView.class);
    RouterConfiguration copy = new RouterConfiguration(original, false);
    validateNoSameInstances(original, copy);
}
Also used : RouterConfiguration(com.vaadin.flow.router.legacy.RouterConfiguration) Test(org.junit.Test)

Example 9 with RouterConfiguration

use of com.vaadin.flow.router.legacy.RouterConfiguration in project flow by vaadin.

the class RouterConfigurationTest method testRoutesCopied.

@Test
public void testRoutesCopied() throws Exception {
    RouterConfiguration original = createConfiguration();
    original.setRoute("foo/bar", createNoopHandler());
    RouterConfiguration copy = new RouterConfiguration(original, false);
    original.removeRoute("foo/bar");
    Assert.assertNotNull("Updating the original should not affect the copy", copy.resolveRoute(new Location("foo/bar")));
}
Also used : RouterConfiguration(com.vaadin.flow.router.legacy.RouterConfiguration) Location(com.vaadin.flow.router.Location) Test(org.junit.Test)

Example 10 with RouterConfiguration

use of com.vaadin.flow.router.legacy.RouterConfiguration in project flow by vaadin.

the class RouterConfigurationTest method testParentViewLoopDetection.

@Test(expected = IllegalStateException.class)
public void testParentViewLoopDetection() {
    RouterConfiguration configuration = createConfiguration();
    configuration.setParentView(AnotherParentView.class, ParentView.class);
    configuration.setParentView(ParentView.class, AnotherParentView.class);
}
Also used : RouterConfiguration(com.vaadin.flow.router.legacy.RouterConfiguration) Test(org.junit.Test)

Aggregations

RouterConfiguration (com.vaadin.flow.router.legacy.RouterConfiguration)13 Test (org.junit.Test)11 Location (com.vaadin.flow.router.Location)5 NavigationHandler (com.vaadin.flow.router.NavigationHandler)4 ImmutableRouterConfiguration (com.vaadin.flow.router.legacy.ImmutableRouterConfiguration)2 Router (com.vaadin.flow.router.legacy.Router)2 UI (com.vaadin.flow.component.UI)1 HistoryStateChangeEvent (com.vaadin.flow.component.page.History.HistoryStateChangeEvent)1 CurrentInstance (com.vaadin.flow.internal.CurrentInstance)1 NavigationEvent (com.vaadin.flow.router.NavigationEvent)1 NavigationTrigger (com.vaadin.flow.router.NavigationTrigger)1 RouterInterface (com.vaadin.flow.router.RouterInterface)1 DefaultErrorView (com.vaadin.flow.router.legacy.DefaultErrorView)1 Resolver (com.vaadin.flow.router.legacy.Resolver)1 ErrorView (com.vaadin.flow.router.legacy.ViewRendererTest.ErrorView)1 TestView (com.vaadin.flow.router.legacy.ViewRendererTest.TestView)1 MockServletConfig (com.vaadin.flow.server.MockServletConfig)1 VaadinRequest (com.vaadin.flow.server.VaadinRequest)1 VaadinResponse (com.vaadin.flow.server.VaadinResponse)1 VaadinService (com.vaadin.flow.server.VaadinService)1