コード例 #1
0
 @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/");
 }
コード例 #2
0
 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());
 }
コード例 #3
0
  @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"));
  }