-
- Type Parameters:
T- the type of the resources created by the resource factory
- All Superinterfaces:
org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource
- All Known Implementing Classes:
TemporaryDirectory
public interface ResourceFactory<T> extends org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResourceResourceFactoryis the common interface for "resource factories", which are responsible for creatingResources.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 implementors of new kinds of resources.
For more details and examples, see the documentation on resources.
- Since:
- 1.9.0
- See Also:
Resource
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidclose()Closes the resource factory.Resource<T>create(java.util.List<java.lang.String> arguments)Returns a new resource.
-
-
-
Method Detail
-
create
Resource<T> create(java.util.List<java.lang.String> arguments) throws java.lang.Exception
Returns a new resource.- Parameters:
arguments- a list of strings to be used to populate or configure the resource- Throws:
java.lang.Exception- if creating the resource failed
-
close
default void close() throws java.lang.ExceptionCloses the resource factory.- Specified by:
closein interfaceorg.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource- Throws:
java.lang.Exception- if closing the resource factory failed
-
-