Class AbstractCompoundTestResourceProvider

    • Field Detail

      • resourceProviders

        protected java.util.List<TestResourceProvider> resourceProviders
        The resource providers wrapped by this compound provider.
    • Constructor Detail

      • AbstractCompoundTestResourceProvider

        protected AbstractCompoundTestResourceProvider​(java.util.List<TestResourceProvider> someProviders)
        Creates a new compound provider, wrapping the given resource providers.
        Parameters:
        someProviders - the providers to wrap
      • AbstractCompoundTestResourceProvider

        protected AbstractCompoundTestResourceProvider​(TestResourceProvider... someProviders)
        Creates a new compound provider, wrapping the given resource providers.
        Parameters:
        someProviders - the providers to wrap
    • Method Detail

      • openResource

        public java.io.InputStream openResource​(TestResource aResourceName)
                                         throws java.io.IOException
        Description copied from interface: TestResourceProvider
        Opens a specific named resource. This should return an InputStream at the start of the data of the respective resources, and it is only expected to work if the resource is one of those enumerated by a call to TestResourceProvider.getResourceNames().
        Specified by:
        openResource in interface TestResourceProvider
        Parameters:
        aResourceName - the resource to be opened
        Returns:
        an InputStream to read the resource
        Throws:
        java.io.IOException
      • closeResource

        public void closeResource​(TestResource aResourceName,
                                  java.io.InputStream aResourceStream)
                           throws java.io.IOException
        Description copied from interface: TestResourceProvider
        Closes a specified resources' stream (and all the stuff opened for this stream in the background).
        Specified by:
        closeResource in interface TestResourceProvider
        Parameters:
        aResourceName - the resource to be closed
        aResourceStream - the resource stream to close
        Throws:
        java.io.IOException
      • getClassLoader

        public java.lang.ClassLoader getClassLoader()
        Description copied from interface: TestResourceProvider
        Returns the classloader to use for all dynamic class resolving needs.
        Specified by:
        getClassLoader in interface TestResourceProvider
        Returns:
        the classloader to use
      • findProvider

        protected <T extends TestResourceProvider> T findProvider​(java.lang.Class<T> aProviderClass)
        Finds a specific provider instance by its type.
        Parameters:
        aProviderClass - the providers' class
        Returns:
        the first instance matching the type