com.atlassian.jira.junit.rules
Class FileResource
java.lang.Object
org.junit.rules.ExternalResource
com.atlassian.jira.junit.rules.FileResource
- All Implemented Interfaces:
- org.junit.rules.TestRule
public class FileResource
- extends org.junit.rules.ExternalResource
Allows to use JUnit Rule to inject files from FS.
Instances of FileResource in tests must be public, if annotated with @Rule.
- Since:
- v6.1
- See Also:
Rule
,
TemporaryFolder
Method Summary |
protected void |
after()
|
protected void |
before()
|
File |
copyOf(String path)
Creates a new copy of a resource mentioned in the path as a file Result file name would differ from the original
file name
NOTE: if mulitple resources exist by given path in classpath, first one is expected to be returned. |
Methods inherited from class org.junit.rules.ExternalResource |
apply |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileResource
public FileResource()
before
protected void before()
throws Throwable
- Overrides:
before
in class org.junit.rules.ExternalResource
- Throws:
Throwable
after
protected void after()
- Overrides:
after
in class org.junit.rules.ExternalResource
copyOf
public File copyOf(String path)
- Creates a new copy of a resource mentioned in the path as a file Result file name would differ from the original
file name
NOTE: if mulitple resources exist by given path in classpath, first one is expected to be returned.
- Parameters:
path
- path to a resource. The resource could be in jar.
- Returns:
- file copy
Copyright © 2002-2013 Atlassian. All Rights Reserved.