-
@ExtendWith(ResourceExtension.class) @Retention(RUNTIME) @Target({PARAMETER,ANNOTATION_TYPE}) public @interface Shared
@Sharedis used to create a resource that is shared with multiple tests.It is part of the "resources" JUnit Jupiter extension, which pertains to anything that needs to be injected into tests and which may need to be started up or torn down. Temporary directories are a common example.
This class is intended for users.
For more details and examples, see the documentation on resources and temporary directories.
- Since:
- 1.9.0
- See Also:
Resource,ResourceFactory,Shared.Scope
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description java.lang.Class<? extends ResourceFactory<?>>factoryThe class of the resource factory to get the resource from.java.lang.StringnameThe unique name of the resource.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description Shared.ScopescopeThe scope for how long the resource will live.
-
-
-
Element Detail
-
factory
java.lang.Class<? extends ResourceFactory<?>> factory
The class of the resource factory to get the resource from.
-
-
-
scope
Shared.Scope scope
The scope for how long the resource will live.The default scope is
Shared.Scope.SOURCE_FILE.- See Also:
Shared.Scope.SOURCE_FILE,Shared.Scope.GLOBAL
- Default:
- org.junitpioneer.jupiter.resource.Shared.Scope.SOURCE_FILE
-
-