Router implements Serializable { public Optional<NavigationState> resolveNavigationTarget(String pathInfo, Map<String, String[]> parameterMap) { Location location = getLocationForRequest(pathInfo, parameterMap); return resolveNavigationTarget(location); } Router(RouteRegistry registry); void initializeUI(UI ui, VaadinRequest initRequest); void initializeUI(UI ui, Location location); Optional<NavigationState> resolveNavigationTarget(String pathInfo,
            Map<String, String[]> parameterMap); Optional<NavigationState> resolveNavigationTarget(
            Location location); Optional<NavigationState> resolveRouteNotFoundNavigationTarget(); int navigate(UI ui, Location location, NavigationTrigger trigger); int navigate(UI ui, Location location, NavigationTrigger trigger,
            JsonValue state); RouteRegistry getRegistry(); Optional<ErrorTargetEntry> getErrorNavigationTarget(
            Exception exception);  }
@Test public void resolveNavigation_pathContainsDots_dotSegmentIsNotParentReference_noException() { router.resolveNavigationTarget("/.../dsfsdfsdf", Collections.emptyMap()); }
@Test public void resolveNavigation_pathContainsDots_pathIsRelative_noException() { router.resolveNavigationTarget("/../dsfsdfsdf", Collections.emptyMap()); }
@Test public void basic_naming_based_routes() throws InvalidRouteConfigurationException { setNavigationTargets(NamingConvention.class, Main.class); Assert.assertEquals(Main.class, router.resolveNavigationTarget("/", Collections.emptyMap()) .get().getNavigationTarget()); Assert.assertEquals( NamingConvention.class, router .resolveNavigationTarget("/namingconvention", Collections.emptyMap()) .get().getNavigationTarget()); }
@Test public void basic_naming_based_routes_with_trailing_view() throws InvalidRouteConfigurationException { setNavigationTargets(NamingConventionView.class, MainView.class); Assert.assertEquals(MainView.class, router.resolveNavigationTarget("/", Collections.emptyMap()) .get().getNavigationTarget()); Assert.assertEquals( NamingConventionView.class, router .resolveNavigationTarget("/namingconvention", Collections.emptyMap()) .get().getNavigationTarget()); }
@Test public void test_naming_based_routes_with_name_view() throws InvalidRouteConfigurationException { setNavigationTargets(View.class); Assert.assertEquals(View.class, router.resolveNavigationTarget("/", Collections.emptyMap()) .get().getNavigationTarget()); }