Annotation Type TestResource
-
@ExtendWith(com.github.robtimus.junit.support.extension.testresource.TestResourceExtension.class) @Target({FIELD,PARAMETER,ANNOTATION_TYPE}) @Retention(RUNTIME) public @interface TestResource
TestResource
can be used to annotate a field or a parameter in a lifecycle method or test method that should be resolved into the contents of a (test) resource. The resource will be loaded relative to the class where the field, constructor or method is defined. The following field / parameter types are supported by default:String
CharSequence
StringBuilder
byte[]
byte[]
,Encoding
can be used to change the encoding to use (defaults to UTF-8).In addition,
LoadWith
can be used to specify a method that is used to load the contents of the resource into an object, orEOL
can be used to define the line separator to use forString
,CharSequence
andStringBuilder
. This can be useful to create tests that work on different operating systems. It is illegal to:- Author:
- Rob Spoor
- Since:
- 2.0
-
-
Element Detail
-
value
String value
The resource to load.
-
-