Package org.springframework.test.web.servlet.request

Examples of org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilder


  }

  @SuppressWarnings("unchecked")
  @Test
  public void testUpload() throws Exception {
    MockMultipartHttpServletRequestBuilder request = fileUpload("/router");
    request.accept(MediaType.ALL).characterEncoding("UTF-8")
        .session(new MockHttpSession());

    request.param("extTID", "1");
    request.param("extAction", "uploadService");
    request.param("extMethod", "upload");
    request.param("extType", "rpc");
    request.param("name", "Ralph");
    request.param("age", "20");
    request.param("admin", "true");
    request.param("salary", "12.3");
    request.param("result", "theResult");

    request.file("fileUpload", "the content of the file".getBytes());

    MvcResult resultMvc = mockMvc.perform(request).andExpect(status().isOk())
        .andExpect(content().contentType("text/html;charset=UTF-8"))
        .andExpect(content().encoding("UTF-8")).andReturn();
View Full Code Here


    mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
  }

  @Test
  public void testUpload() throws Exception {
    MockMultipartHttpServletRequestBuilder request = fileUpload("/router");
    request.accept(MediaType.ALL).characterEncoding("UTF-8")
        .session(new MockHttpSession());

    request.param("extTID", "1");
    request.param("extAction", "uploadService");
    request.param("extMethod", "upload");
    request.param("extType", "rpc");
    request.param("result", "theResult");

    request.file("fileUpload", "the content of the file".getBytes());

    MvcResult resultMvc = mockMvc.perform(request).andExpect(status().isOk())
        .andExpect(content().contentType("text/html;charset=UTF-8"))
        .andExpect(content().encoding("UTF-8")).andReturn();
View Full Code Here

TOP

Related Classes of org.springframework.test.web.servlet.request.MockMultipartHttpServletRequestBuilder

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.