RouteUtil { public static String getRoutePath(Class<?> component, Route route) { if (route.absolute()) { return resolve(component, route); } List<String> parentRoutePrefixes = getRoutePrefixes(component, route.layout(), resolve(component, route)); return parentRoutePrefixes.stream().collect(Collectors.joining("/")); } protected  RouteUtil(); static List<Class<? extends RouterLayout>> getParentLayouts(
            Class<?> component, String path); static String getRoutePath(Class<?> component, Route route); static String getRouteAliasPath(Class<?> component,
            RouteAlias alias); static List<Class<? extends RouterLayout>> getParentLayoutsForNonRouteTarget(
            Class<?> navigationTarget); static Class<? extends RouterLayout> getTopParentLayout(
            final Class<?> component, final String path); static String resolve(Class<?> component, Route route); static void updateRouteRegistry(RouteRegistry registry,
            Set<Class<?>> addedClasses, Set<Class<?>> modifiedClasses,
            Set<Class<?>> deletedClasses);  }
@Test public void route_path_should_contain_parent_prefix() { String routePath = RouteUtil.getRoutePath( BaseRouteWithParentPrefixAndRouteAlias.class, BaseRouteWithParentPrefixAndRouteAlias.class .getAnnotation(Route.class)); Assert.assertEquals( "Expected path should only have been parent RoutePrefix", "parent", routePath); }
@Test public void absolute_route_should_not_contain_parent_prefix() { String routePath = RouteUtil.getRoutePath(AbsoluteRoute.class, AbsoluteRoute.class.getAnnotation(Route.class)); Assert.assertEquals("No parent prefix should have been added.", "single", routePath); }
@Test public void absolute_middle_parent_route_should_not_contain_parent_prefix() { String routePath = RouteUtil.getRoutePath(AbsoluteRoute.class, AbsoluteCenterRoute.class.getAnnotation(Route.class)); Assert.assertEquals("No parent prefix should have been added.", "absolute/child", routePath); }
@Test public void route_path_should_contain_route_and_parent_prefix() { String routePath = RouteUtil.getRoutePath( RouteWithParentPrefixAndRouteAlias.class, RouteWithParentPrefixAndRouteAlias.class .getAnnotation(Route.class)); Assert.assertEquals( "Expected path should only have been parent RoutePrefix", "parent/flow", routePath); }