Package org.junit.jupiter.api
Annotation Type TestFactory
-
@Target({ANNOTATION_TYPE,METHOD}) @Retention(RUNTIME) @Documented @API(status=MAINTAINED, since="5.3") @Testable public @interface TestFactory@TestFactoryis used to signal that the annotated method is a test factory method.In contrast to
@Testmethods, a test factory is not itself a test case but rather a factory for test cases.@TestFactorymethods must not beprivateorstaticand must return aStream,Collection,Iterable,Iterator, or array ofDynamicNodeinstances. Supported subclasses ofDynamicNodeincludeDynamicContainerandDynamicTest. Dynamic tests will be executed lazily, enabling dynamic and even non-deterministic generation of test cases.Any
Streamreturned by a@TestFactorywill be properly closed by callingstream.close(), making it safe to use a resource such asFiles.lines()as the initial source of the stream.@TestFactorymethods may optionally declare parameters to be resolved byParameterResolvers.- Since:
- 5.0
- See Also:
Test,DynamicNode,DynamicTest,DynamicContainer