T
- the type of the resource to loadpublic abstract class TestResource<T> extends Object implements org.junit.rules.TestRule
By default, a resource is located relative to the class, meaning it has to reside in the same folder.
Modifier and Type | Field and Description |
---|---|
protected String |
nameSuffix |
protected Class |
testClass |
Constructor and Description |
---|
TestResource(Class testClass,
String nameSuffix) |
Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement statement,
org.junit.runner.Description description) |
T |
get() |
protected abstract T |
load(InputStream testResourceStream) |
protected String |
toFileName(String testMethodName)
Composes the file name of the resource based upon a hyphenated version of the test class and method name and the
given name suffix.
|
protected String |
toRelativePathFromClassLoaderRoot(Method testMethod) |
public final org.junit.runners.model.Statement apply(org.junit.runners.model.Statement statement, org.junit.runner.Description description)
apply
in interface org.junit.rules.TestRule
protected abstract T load(InputStream testResourceStream)
protected String toRelativePathFromClassLoaderRoot(Method testMethod)
protected String toFileName(String testMethodName)
Example:
{@code public class VersionedTemplateTest {
public T get()
Copyright © 2003–2017 Atlassian. All rights reserved.