Package at.willhaben.willtest.rule
Class ResourceHelper
- java.lang.Object
-
- at.willhaben.willtest.rule.TestFailureAwareRule
-
- at.willhaben.willtest.rule.ResourceHelper
-
- All Implemented Interfaces:
org.junit.rules.TestRule
@Deprecated public class ResourceHelper extends TestFailureAwareRule
Deprecated.use Temporary Folder ExtensionMakes possible to upload a classpath resource file using Selenium.Selenium can upload only
Fileinstances (SeeFileDetector). 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 alsoFileDetectorConfigurator.
-
-
Constructor Summary
Constructors Constructor Description ResourceHelper()Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidafter(org.junit.runner.Description description, java.lang.Throwable testFailure)Deprecated.Called after all tests always.protected voidbefore(org.junit.runner.Description description)Deprecated.Can do something before a test.java.io.FilegetResourceAsFile(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 at.willhaben.willtest.rule.TestFailureAwareRule
apply, onError
-
-
-
-
Method Detail
-
before
protected void before(org.junit.runner.Description description) throws java.lang.ThrowableDeprecated.Description copied from class:TestFailureAwareRuleCan do something before a test. By default it does nothing.- Overrides:
beforein classTestFailureAwareRule- 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.ThrowableDeprecated.Description copied from class:TestFailureAwareRuleCalled after all tests always. By default it does nothing.- Overrides:
afterin classTestFailureAwareRule- Parameters:
description- junit test description objecttestFailure- in case of failed test it contains an exception. Otherwise null- Throws:
java.lang.Throwable- iftestFailureis null, it will fly, iftestFailureis not null, it will be added to that as suppressed exception. SeeThrowable.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.
-
-