Package org.springframework.mock.web.test

Examples of org.springframework.mock.web.test.MockHttpServletRequest


    BeanNameUrlHandlerMapping hm = (BeanNameUrlHandlerMapping) wac.getBean("handlerMapping");
    Object anotherHandler = new Object();
    hm.registerHandler("/mypath/testaross*", anotherHandler);
    Object bean = wac.getBean("godCtrl");

    MockHttpServletRequest req = new MockHttpServletRequest("GET", "/mypath/test.html");
    HandlerExecutionChain hec = hm.getHandler(req);
    assertTrue("Handler is correct bean", hec != null && hec.getHandler() == bean);

    req = new MockHttpServletRequest("GET", "/mypath/testarossa");
    hec = hm.getHandler(req);
    assertTrue("Handler is correct bean", hec != null && hec.getHandler() == anotherHandler);

    req = new MockHttpServletRequest("GET", "/mypath/tes");
    hec = hm.getHandler(req);
    assertTrue("Handler is correct bean", hec == null);
  }
View Full Code Here


    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("index"), chain.getHandler());
  }

  public void testMapSimpleUri() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/welcome");
    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }
View Full Code Here

    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }

  public void testWithContextPath() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myapp/welcome");
    request.setContextPath("/myapp");
    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }
View Full Code Here

    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }

  public void testWithMultiActionControllerMapping() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/admin");
    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("admin"), chain.getHandler());
  }
View Full Code Here

    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("admin"), chain.getHandler());
  }

  public void testWithoutControllerSuffix() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/buy");
    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("buy"), chain.getHandler());
  }
View Full Code Here

    this.hm3 = (HandlerMapping) this.wac.getBean("mapping3");
    this.hm4 = (HandlerMapping) this.wac.getBean("mapping4");
  }

  public void testIndexUri() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/");
    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("index"), chain.getHandler());
  }
View Full Code Here

    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("index"), chain.getHandler());
  }

  public void testMapSimpleUri() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/welcome");
    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }
View Full Code Here

    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }

  public void testWithContextPath() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myapp/welcome");
    request.setContextPath("/myapp");
    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }
View Full Code Here

    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("welcome"), chain.getHandler());
  }

  public void testWithMultiActionControllerMapping() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/admin/user");
    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("admin"), chain.getHandler());

    request = new MockHttpServletRequest("GET", "/admin/product");
    chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("admin"), chain.getHandler());
  }
View Full Code Here

    chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("admin"), chain.getHandler());
  }

  public void testWithoutControllerSuffix() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/buyform");
    HandlerExecutionChain chain = this.hm.getHandler(request);
    assertEquals(this.wac.getBean("buy"), chain.getHandler());
  }
View Full Code Here

TOP

Related Classes of org.springframework.mock.web.test.MockHttpServletRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.