Class ResourceHelper

  • All Implemented Interfaces:
    org.junit.rules.TestRule

    @Deprecated
    public class ResourceHelper
    extends TestFailureAwareRule
    Deprecated.
    use Temporary Folder Extension
    Makes possible to upload a classpath resource file using Selenium.

    Selenium can upload only File instances (See FileDetector). In tests you might want to upload a file, which is inside a JAR file you are having on the classpath. This rule can copy such resources into a temp file, which will be then available during the test for being uploaded. After the test the cleanup of such files happens automatically. See also FileDetectorConfigurator.

    • Constructor Summary

      Constructors 
      Constructor Description
      ResourceHelper()
      Deprecated.
       
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      protected void after​(org.junit.runner.Description description, java.lang.Throwable testFailure)
      Deprecated.
      Called after all tests always.
      protected void before​(org.junit.runner.Description description)
      Deprecated.
      Can do something before a test.
      java.io.File getResourceAsFile​(java.lang.String resourcePath)
      Deprecated.
      Gets resource either from a jar or from a file as stream, and writes its content into a temp file.
      • Methods inherited from class java.lang.Object

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

      • ResourceHelper

        public ResourceHelper()
        Deprecated.
    • Method Detail

      • before

        protected void before​(org.junit.runner.Description description)
                       throws java.lang.Throwable
        Deprecated.
        Description copied from class: TestFailureAwareRule
        Can do something before a test. By default it does nothing.
        Overrides:
        before in class TestFailureAwareRule
        Parameters:
        description - junit test description object
        Throws:
        java.lang.Throwable - any error from the test
      • after

        protected void after​(org.junit.runner.Description description,
                             java.lang.Throwable testFailure)
                      throws java.lang.Throwable
        Deprecated.
        Description copied from class: TestFailureAwareRule
        Called after all tests always. By default it does nothing.
        Overrides:
        after in class TestFailureAwareRule
        Parameters:
        description - junit test description object
        testFailure - in case of failed test it contains an exception. Otherwise null
        Throws:
        java.lang.Throwable - if testFailure is null, it will fly, if testFailure is not null, it will be added to that as suppressed exception. See Throwable.addSuppressed(Throwable)
      • getResourceAsFile

        public java.io.File getResourceAsFile​(java.lang.String resourcePath)
        Deprecated.
        Gets resource either from a jar or from a file as stream, and writes its content into a temp file.
        Parameters:
        resourcePath - classpath resource path
        Returns:
        temp file path. This file will be cleaned up automatically after the test.