Class MockStringResourceLoader

  • All Implemented Interfaces:
    org.springframework.core.io.ResourceLoader

    public class MockStringResourceLoader
    extends MockResourceLoader
    Loads Resources from Strings that are registered as Mock resources.
    Since:
    0.4
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.springframework.core.io.DefaultResourceLoader

        org.springframework.core.io.DefaultResourceLoader.ClassPathContextResource
    • Field Summary

      • Fields inherited from interface org.springframework.core.io.ResourceLoader

        CLASSPATH_URL_PREFIX
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.core.io.Resource getResource​(java.lang.String location)  
      void registerMockResource​(java.lang.String location, byte[] contents)
      Registers a mock resource with the first argument as the location and the second as the contents of the resource.
      void registerMockResource​(java.lang.String location, java.lang.String contents)
      Registers a mock resource with the first argument as the location and the second as the contents of the resource.
      void registerMockResource​(java.lang.String location, org.springframework.core.io.Resource res)
      Registers a mock resource with the first argument as the location and the second as the contents of the resource.
      • Methods inherited from class org.springframework.core.io.DefaultResourceLoader

        addProtocolResolver, clearResourceCaches, getClassLoader, getProtocolResolvers, getResourceByPath, getResourceCache, setClassLoader
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MockStringResourceLoader

        public MockStringResourceLoader()
    • Method Detail

      • getResource

        public org.springframework.core.io.Resource getResource​(java.lang.String location)
        Specified by:
        getResource in interface org.springframework.core.io.ResourceLoader
        Overrides:
        getResource in class MockResourceLoader
      • registerMockResource

        public void registerMockResource​(java.lang.String location,
                                         org.springframework.core.io.Resource res)
        Registers a mock resource with the first argument as the location and the second as the contents of the resource.
        Parameters:
        location - The location
        res - The resource itself
      • registerMockResource

        public void registerMockResource​(java.lang.String location,
                                         java.lang.String contents)
        Registers a mock resource with the first argument as the location and the second as the contents of the resource.
        Parameters:
        location - The location
        contents - The contents of the resource
      • registerMockResource

        public void registerMockResource​(java.lang.String location,
                                         byte[] contents)
        Registers a mock resource with the first argument as the location and the second as the contents of the resource.
        Parameters:
        location - The location
        contents - The contents of the resource