Class MockFileResource

  • All Implemented Interfaces:
    org.springframework.core.io.InputStreamSource, org.springframework.core.io.Resource

    public class MockFileResource
    extends org.springframework.core.io.ByteArrayResource
    Mocks the behavior of a FileResource.
    Since:
    1.1
    • Constructor Summary

      Constructors 
      Constructor Description
      MockFileResource​(java.lang.String fileName, java.lang.String contents)  
      MockFileResource​(java.lang.String fileName, java.lang.String contents, java.lang.String encoding)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getFilename()  
      • Methods inherited from class org.springframework.core.io.ByteArrayResource

        contentLength, equals, exists, getByteArray, getDescription, getInputStream, hashCode
      • Methods inherited from class org.springframework.core.io.AbstractResource

        createRelative, getFile, getFileForLastModifiedCheck, getURI, getURL, isFile, isOpen, isReadable, lastModified, readableChannel, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MockFileResource

        public MockFileResource​(java.lang.String fileName,
                                java.lang.String contents)
                         throws java.io.UnsupportedEncodingException
        Throws:
        java.io.UnsupportedEncodingException
      • MockFileResource

        public MockFileResource​(java.lang.String fileName,
                                java.lang.String contents,
                                java.lang.String encoding)
                         throws java.io.UnsupportedEncodingException
        Throws:
        java.io.UnsupportedEncodingException
    • Method Detail

      • getFilename

        public java.lang.String getFilename()
        Specified by:
        getFilename in interface org.springframework.core.io.Resource
        Overrides:
        getFilename in class org.springframework.core.io.AbstractResource