@Test public void testCaptureGroup() throws Exception { RouterAssert router = new RouterAssert(); router.append("/{a}", Collections.singletonMap(Names.A, PathParam.matching("a(.)c").captureGroup(true))); // router.assertRoute(Collections.singletonMap(Names.A, "b"), "/abc"); }
@Test public void testCaptureGroup() throws Exception { RouterAssert router = new RouterAssert(); router.append("/{a}", Collections.singletonMap(Names.A, PathParam.matching("a(.)c").captureGroup(true))); // router.assertRoute(Collections.singletonMap(Names.A, "b"), "/abc"); }
@Test public void testJSMin() throws Exception { RouterAssert router = new RouterAssert(); Route r = router.append("/foo{gtn:min}.js", Collections.singletonMap(Names.GTN_MIN, PathParam.matching("-(min)|").captureGroup(true))); // router.assertRoute(Collections.singletonMap(Names.GTN_MIN, "min"), "/foo-min.js"); router.assertRoute(Collections.singletonMap(Names.GTN_MIN, ""), "/foo.js"); assertNull(router.route("/foo-max.js")); // assertEquals("/foo-min.js", r.matches(Collections.singletonMap(Names.GTN_MIN, "min")).render()); assertEquals("/foo.js", r.matches(Collections.singletonMap(Names.GTN_MIN, "")).render()); assertNull(r.matches(Collections.singletonMap(Names.GTN_MIN, "max"))); } }
@Test public void testJSMin() throws Exception { RouterAssert router = new RouterAssert(); Route r = router.append("/foo{gtn:min}.js", Collections.singletonMap(Names.GTN_MIN, PathParam.matching("-(min)|").captureGroup(true))); // router.assertRoute(Collections.singletonMap(Names.GTN_MIN, "min"), "/foo-min.js"); router.assertRoute(Collections.singletonMap(Names.GTN_MIN, ""), "/foo.js"); assertNull(router.route("/foo-max.js")); // assertEquals("/foo-min.js", r.matches(Collections.singletonMap(Names.GTN_MIN, "min")).render()); assertEquals("/foo.js", r.matches(Collections.singletonMap(Names.GTN_MIN, "")).render()); assertNull(r.matches(Collections.singletonMap(Names.GTN_MIN, "max"))); } }
@Test public void testCaptureGroup() throws Exception { Router router = new Router(); Route r = router.append("/{a}", Collections.singletonMap(Names.A, PathParam.matching("a(.)c").captureGroup(true))); // assertEquals("/abc", r.matches(Collections.singletonMap(Names.A, "b")).render()); } }
@Test public void testCaptureGroup() throws Exception { Router router = new Router(); Route r = router.append("/{a}", Collections.singletonMap(Names.A, PathParam.matching("a(.)c").captureGroup(true))); // assertEquals("/abc", r.matches(Collections.singletonMap(Names.A, "b")).render()); } }