RouterLink extends Component implements HasText, HasComponents,
        HasStyle, AfterNavigationObserver, Focusable<RouterLink> { public void setRoute(Router router, Class<? extends Component> navigationTarget) { setRoute(router, navigationTarget, RouteParameters.empty()); } RouterLink();  RouterLink(String text,
            Class<? extends Component> navigationTarget); <T, C extends Component & HasUrlParameter<T>> RouterLink(String text,
            Class<? extends C> navigationTarget, T parameter);  RouterLink(String text, Class<? extends Component> navigationTarget,
            RouteParameters parameters);  RouterLink(Router router, String text,
            Class<? extends Component> navigationTarget); <T, C extends Component & HasUrlParameter<T>> RouterLink(
            Router router, String text, Class<? extends C> navigationTarget,
            T parameter);  RouterLink(Router router, String text,
            Class<? extends Component> navigationTarget,
            RouteParameters parameters); void setRoute(Router router,
            Class<? extends Component> navigationTarget); void setRoute(
            Router router, Class<? extends C> navigationTarget, T parameter); void setRoute(Router router,
            Class<? extends Component> navigationTarget,
            RouteParameters parameters); void setRoute(Class<? extends Component> navigationTarget); void setRoute(
            Class<? extends C> navigationTarget, T parameter); void setRoute(Class<? extends Component> navigationTarget,
            RouteParameters parameters); String getHref(); Optional<QueryParameters> getQueryParameters(); void setQueryParameters(QueryParameters queryParameters); HighlightCondition<RouterLink> getHighlightCondition(); void setHighlightCondition(
            HighlightCondition<RouterLink> highlightCondition); HighlightAction<RouterLink> getHighlightAction(); void setHighlightAction(
            HighlightAction<RouterLink> highlightAction); @Override void afterNavigation(AfterNavigationEvent event);  }
@Test public void setRoute_attachedLink() { UI ui = new UI(); RouterLink link = new RouterLink(); ui.add(link); link.setRoute(router, TestView.class, "foo"); Assert.assertTrue(link.getElement().hasAttribute("href")); Assert.assertEquals("bar/foo", link.getElement().getAttribute("href")); }
@Test public void setRoute_withoutRouter() { RouterLink link = new RouterLink(); ui.add(link); link.setRoute(FooNavigationTarget.class); Assert.assertTrue(link.getElement().hasAttribute("href")); Assert.assertEquals("foo", link.getElement().getAttribute("href")); }
@Test public void setRoute_withoutRouterWithParameter() { RouterLink link = new RouterLink(); ui.add(link); link.setRoute(GreetingNavigationTarget.class, "foo"); Assert.assertTrue(link.getElement().hasAttribute("href")); Assert.assertEquals("greeting/foo", link.getElement().getAttribute("href")); }
@Test public void createReconfigureRouterLink_implicitCurrentVaadinServiceRouter() { RouterLink link = new RouterLink("Show something", TestView.class, "something"); link.setRoute(router, TestView.class, "other"); Assert.assertEquals("bar/other", link.getElement().getAttribute("href")); link.setRoute(router, TestView.class, "changed"); Assert.assertEquals("bar/changed", link.getElement().getAttribute("href")); }
@Test public void createReconfigureRouterLink_explicitRouter() { RouterLink link = new RouterLink(router, "Show something", TestView.class, "something"); link.setRoute(router, TestView.class, "other"); Assert.assertEquals("bar/other", link.getElement().getAttribute("href")); link.setRoute(router, TestView.class, "changed"); Assert.assertEquals("bar/changed", link.getElement().getAttribute("href")); }
@Test public void reconfigureRouterLink_attachedLink() { RouterLink link = new RouterLink(); ui.add(link); link.setRoute(router, TestView.class, "other"); Assert.assertEquals("bar/other", link.getElement().getAttribute("href")); link.setRoute(router, TestView.class, "changed"); Assert.assertEquals("bar/changed", link.getElement().getAttribute("href")); }