@Test(expected = RoutingException.class) public void testPut() throws RoutingException { Routes.load(ResourceUtil.getResourceAsFile("routes/via.xml")); System.out.println(Routes.getRouteSet().toString()); MockHttpServletRequest request = ((MockHttpServletRequest) RequestUtil.getRequest()); request.setMethod("PUT"); Routes.recognizePath("/methods/"); }
public void testServletRequestHeaderMap() { MockHttpServletRequest request = getRequest(); request.addHeader("a", "A"); ServletRequestHeaderMap map = new ServletRequestHeaderMap(request); assertEquals("A", map.getAttribute("a")); Iterator it = map.getAttributeNames(); assertNotNull(it); assertEquals("a", it.next()); }
@Test public void testPost() { Routes.load(ResourceUtil.getResourceAsFile("routes/via.xml")); System.out.println(Routes.getRouteSet().toString()); MockHttpServletRequest request = ((MockHttpServletRequest) RequestUtil.getRequest()); request.setMethod("POST"); Options options = Routes.recognizePath("/methods/"); System.out.println(options); assertThat(options.getString("action"), is("getAndPost")); }