Class GrailsMockMultipartFile

  • All Implemented Interfaces:
    org.springframework.core.io.InputStreamSource, org.springframework.web.multipart.MultipartFile

    public class GrailsMockMultipartFile
    extends org.springframework.mock.web.MockMultipartFile
    Extends the default Spring MockMultipartFile to provide an implementation of transferTo that doesn't use the file system.
    Since:
    2.0
    • Constructor Summary

      Constructors 
      Constructor Description
      GrailsMockMultipartFile​(java.lang.String name, byte[] content)  
      GrailsMockMultipartFile​(java.lang.String name, java.io.InputStream contentStream)  
      GrailsMockMultipartFile​(java.lang.String name, java.lang.String originalFilename, java.lang.String contentType, byte[] content)  
      GrailsMockMultipartFile​(java.lang.String name, java.lang.String originalFilename, java.lang.String contentType, java.io.InputStream contentStream)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.File getTargetFileLocation()  
      void transferTo​(java.io.File dest)  
      • Methods inherited from class org.springframework.mock.web.MockMultipartFile

        getBytes, getContentType, getInputStream, getName, getOriginalFilename, getSize, isEmpty
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.springframework.web.multipart.MultipartFile

        getResource, transferTo
    • Constructor Detail

      • GrailsMockMultipartFile

        public GrailsMockMultipartFile​(java.lang.String name,
                                       byte[] content)
      • GrailsMockMultipartFile

        public GrailsMockMultipartFile​(java.lang.String name,
                                       java.io.InputStream contentStream)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • GrailsMockMultipartFile

        public GrailsMockMultipartFile​(java.lang.String name,
                                       java.lang.String originalFilename,
                                       java.lang.String contentType,
                                       byte[] content)
      • GrailsMockMultipartFile

        public GrailsMockMultipartFile​(java.lang.String name,
                                       java.lang.String originalFilename,
                                       java.lang.String contentType,
                                       java.io.InputStream contentStream)
                                throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • transferTo

        public void transferTo​(java.io.File dest)
                        throws java.io.IOException,
                               java.lang.IllegalStateException
        Specified by:
        transferTo in interface org.springframework.web.multipart.MultipartFile
        Overrides:
        transferTo in class org.springframework.mock.web.MockMultipartFile
        Throws:
        java.io.IOException
        java.lang.IllegalStateException
      • getTargetFileLocation

        public java.io.File getTargetFileLocation()
        Returns:
        The location where the MultipartFile was transfered to