Package org.springframework.mock.web.test

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


        wac.registerBeanDefinition("handlerAdapter", adapterDef);
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/my.do");
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.service(request, response);
    assertEquals("myView", response.getContentAsString());
View Full Code Here


        wac.registerBeanDefinition("controller", new RootBeanDefinition(MethodNameDispatchingController.class));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/methodnamedispatching/myHandle");
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.service(request, response);
    assertEquals("myView", response.getContentAsString());
View Full Code Here

            new RootBeanDefinition(MyPostMethodNameDispatchingController.class));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myHandle.do");
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.service(request, response);
    assertEquals(405, response.getStatus());
View Full Code Here

  }

  @Test
  public void relativePathDispatchingController() throws Exception {
    initServlet(MyRelativePathDispatchingController.class);
    servlet.init(new MockServletConfig());

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myApp/myHandle");
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.service(request, response);
    assertEquals("myView", response.getContentAsString());
View Full Code Here

  }

  @Test
  public void relativeMethodPathDispatchingController() throws Exception {
    initServlet(MyRelativeMethodPathDispatchingController.class);
    servlet.init(new MockServletConfig());

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myApp/myHandle");
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.service(request, response);
    assertEquals("myView", response.getContentAsString());
View Full Code Here

  }

  @Test
  public void nullCommandController() throws Exception {
    initServlet(MyNullCommandController.class);
    servlet.init(new MockServletConfig());

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myPath");
    request.setUserPrincipal(new OtherPrincipal());
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.service(request, response);
View Full Code Here

  }

  @Test
  public void equivalentMappingsWithSameMethodName() throws Exception {
    initServlet(ChildController.class);
    servlet.init(new MockServletConfig());

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/child/test");
    request.addParameter("childId", "100");
    MockHttpServletResponse response = new MockHttpServletResponse();
    try {
View Full Code Here

        wac.registerBeanDefinition("handlerAdapter", adapterDef);
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());

    MockHttpServletRequest request = new MockHttpServletRequest("PUT", "/something");
    String requestBody = "Hello World";
    request.setContent(requestBody.getBytes("UTF-8"));
    request.addHeader("Content-Type", "text/plain; charset=utf-8");
View Full Code Here

        wac.registerBeanDefinition("handlerAdapter", adapterDef);
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());

    MockHttpServletRequest request = new MockHttpServletRequest("PUT", "/something");
    String requestBody = "Hello World";
    request.setContent(requestBody.getBytes("UTF-8"));
    request.addHeader("Content-Type", "application/pdf");
View Full Code Here

        wac.registerBeanDefinition("handlerAdapter", adapterDef);
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());

    MockHttpServletRequest request = new MockHttpServletRequest("PUT", "/something");
    String requestBody = "Hello World";
    request.setContent(requestBody.getBytes("UTF-8"));
    request.addHeader("Content-Type", "application/pdf");
View Full Code Here

TOP

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

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.