Annotation Type TestResource.Loader


  • @ExtendWith(com.github.robtimus.junit.support.extension.testresource.TestResourceExtension.class)
    @Target({FIELD,PARAMETER,METHOD,CONSTRUCTOR,TYPE,ANNOTATION_TYPE})
    @Retention(RUNTIME)
    public static @interface TestResource.Loader
    Loader can be used in combination with TestResource to specify a custom ResourceLoader to use. This is usually only necessary for Java modules to be able to load resources that are in folders that don't match exported packages. The ResourceLoader to use is looked up in the following order:
    1. A Loader annotation on the field or parameter itself
    2. For parameters, a Loader annotation on the constructor or method
    3. A Loader annotation on the class defining the field, constructor or method
    4. A Loader annotation on any declaring class
    5. The fully qualified class name of the default ResourceLoader implementation that is defined via the "com.github.robtimus.junit.support.extension.testresource.loader" configuration parameter, which can be supplied via the JUnit Launcher API, build tools (e.g., Gradle and Maven), a JVM system property, or the JUnit Platform configuration file (i.e., a file named junit-platform.properties in the root of the class path). Consult the JUnit User Guide for further information.
    Author:
    Rob Spoor
    Since:
    3.2