@Test public void testClear() throws Exception { Router router = new Router(); Route foo = router.append("/foo"); RouteMatch match = router.route("/foo"); assertNotNull(match); assertSame(foo, match.getRoute()); Route bar = foo.append("/bar"); // /*RouteMatch*/ match = router.route("/foo/bar"); assertNotNull(match); assertSame(bar, match.getRoute()); // foo.clearChildren(); match = router.route("/foo/bar"); assertNull(match); match = router.route("/foo"); assertNotNull(match); assertSame(foo, match.getRoute()); }
@Test public void testClear() throws Exception { Router router = new Router(); Route foo = router.append("/foo"); RouteMatch match = router.route("/foo"); assertNotNull(match); assertSame(foo, match.getRoute()); Route bar = foo.append("/bar"); // /*RouteMatch*/ match = router.route("/foo/bar"); assertNotNull(match); assertSame(bar, match.getRoute()); // foo.clearChildren(); match = router.route("/foo/bar"); assertNull(match); match = router.route("/foo"); assertNotNull(match); assertSame(foo, match.getRoute()); }