@Test public void testRestPath() { DefaultHandlerRegistry.RestPath restPath = new DefaultHandlerRegistry.RestPath("/service/const1/{p1}/{p2}+/const2/{p3}", null); DefaultHandlerRegistry.RestInvocationWrapper wrapper = restPath.accept("service/const1/a/b,c/const2/d".split("/")); assertArrayEquals(wrapper.pathParams.get("p1"), new String[]{"a"}); assertArrayEquals(wrapper.pathParams.get("p2"), new String[]{"b","c"}); assertArrayEquals(wrapper.pathParams.get("p3"), new String[]{"d"}); wrapper = restPath.accept("service/const1/a/b/const2".split("/")); assertArrayEquals(wrapper.pathParams.get("p1"), new String[]{"a"}); assertArrayEquals(wrapper.pathParams.get("p2"), new String[]{"b"}); assertNull(wrapper.pathParams.get("p3")); assertNull(restPath.accept("service/const1/{p1}/{p2}+".split("/"))); assertNull(restPath.accept("service/constmiss/{p1}/{p2}+/const2".split("/"))); }
@Test public void testRestPath() { DefaultHandlerRegistry.RestPath restPath = new DefaultHandlerRegistry.RestPath("/service/const1/{p1}/{p2}+/const2/{p3}", null); DefaultHandlerRegistry.RestInvocationWrapper wrapper = restPath.accept("service/const1/a/b,c/const2/d".split("/")); assertArrayEquals(wrapper.pathParams.get("p1"), new String[]{"a"}); assertArrayEquals(wrapper.pathParams.get("p2"), new String[]{"b","c"}); assertArrayEquals(wrapper.pathParams.get("p3"), new String[]{"d"}); wrapper = restPath.accept("service/const1/a/b/const2".split("/")); assertArrayEquals(wrapper.pathParams.get("p1"), new String[]{"a"}); assertArrayEquals(wrapper.pathParams.get("p2"), new String[]{"b"}); assertNull(wrapper.pathParams.get("p3")); assertNull(restPath.accept("service/const1/{p1}/{p2}+".split("/"))); assertNull(restPath.accept("service/constmiss/{p1}/{p2}+/const2".split("/"))); }
@Test public void testRestPath() { DefaultHandlerRegistry.RestPath restPath = new DefaultHandlerRegistry.RestPath("/service/const1/{p1}/{p2}+/const2/{p3}", null); DefaultHandlerRegistry.RestInvocationWrapper wrapper = restPath.accept("service/const1/a/b,c/const2/d".split("/")); assertArrayEquals(wrapper.pathParams.get("p1"), new String[]{"a"}); assertArrayEquals(wrapper.pathParams.get("p2"), new String[]{"b","c"}); assertArrayEquals(wrapper.pathParams.get("p3"), new String[]{"d"}); wrapper = restPath.accept("service/const1/a/b/const2".split("/")); assertArrayEquals(wrapper.pathParams.get("p1"), new String[]{"a"}); assertArrayEquals(wrapper.pathParams.get("p2"), new String[]{"b"}); assertNull(wrapper.pathParams.get("p3")); assertNull(restPath.accept("service/const1/{p1}/{p2}+".split("/"))); assertNull(restPath.accept("service/constmiss/{p1}/{p2}+/const2".split("/"))); }
@Test public void testRestPath() { DefaultHandlerRegistry.RestPath restPath = new DefaultHandlerRegistry.RestPath("/service/const1/{p1}/{p2}+/const2/{p3}", null); DefaultHandlerRegistry.RestInvocationWrapper wrapper = restPath.accept("service/const1/a/b,c/const2/d".split("/")); assertArrayEquals(wrapper.pathParams.get("p1"), new String[]{"a"}); assertArrayEquals(wrapper.pathParams.get("p2"), new String[]{"b","c"}); assertArrayEquals(wrapper.pathParams.get("p3"), new String[]{"d"}); wrapper = restPath.accept("service/const1/a/b/const2".split("/")); assertArrayEquals(wrapper.pathParams.get("p1"), new String[]{"a"}); assertArrayEquals(wrapper.pathParams.get("p2"), new String[]{"b"}); assertNull(wrapper.pathParams.get("p3")); assertNull(restPath.accept("service/const1/{p1}/{p2}+".split("/"))); assertNull(restPath.accept("service/constmiss/{p1}/{p2}+/const2".split("/"))); }
@Test public void testRestPath() { DefaultHandlerRegistry.RestPath restPath = new DefaultHandlerRegistry.RestPath("/service/const1/{p1}/{p2}+/const2/{p3}", null); DefaultHandlerRegistry.RestInvocationWrapper wrapper = restPath.accept("service/const1/a/b,c/const2/d".split("/")); assertArrayEquals(wrapper.pathParams.get("p1"), new String[]{"a"}); assertArrayEquals(wrapper.pathParams.get("p2"), new String[]{"b","c"}); assertArrayEquals(wrapper.pathParams.get("p3"), new String[]{"d"}); wrapper = restPath.accept("service/const1/a/b/const2".split("/")); assertArrayEquals(wrapper.pathParams.get("p1"), new String[]{"a"}); assertArrayEquals(wrapper.pathParams.get("p2"), new String[]{"b"}); assertNull(wrapper.pathParams.get("p3")); assertNull(restPath.accept("service/const1/{p1}/{p2}+".split("/"))); assertNull(restPath.accept("service/constmiss/{p1}/{p2}+/const2".split("/"))); }