Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockMultipartFile


    assertTrue("Wrong filename: " + uploaded, uploaded.matches("spam.foo.*\\.properties$"));
  }

  @Test
  public void testEmptyUpload() throws Exception {
    MockMultipartFile file = new MockMultipartFile("foo", "foo.properties", "text/plain", "".getBytes());
    ExtendedModelMap model = new ExtendedModelMap();
    Date date = new Date();
    BindException errors = new BindException(date, "date");
    controller.upload("spam", file, model, 0, 20, date, errors);
    assertTrue(errors.hasErrors());
View Full Code Here


public class FileUploadControllerTests extends AbstractContextControllerTests {

  @Test
  public void readString() throws Exception {

    MockMultipartFile file = new MockMultipartFile("file", "orig", null, "bar".getBytes());

    webAppContextSetup(this.wac).build()
        .perform(fileUpload("/fileupload").file(file))
        .andExpect(model().attribute("message", "File 'orig' uploaded successfully"));
  }
View Full Code Here

TOP

Related Classes of org.springframework.mock.web.MockMultipartFile

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.