Skip to content

Commit

Permalink
Document single DynamicNode as return value
Browse files Browse the repository at this point in the history
Addresses #1521
  • Loading branch information
sormuras committed Sep 25, 2018
1 parent 974d82d commit 5e83bfd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions documentation/src/docs/asciidoc/user-guide/writing-tests.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1278,12 +1278,13 @@ generated at runtime by a factory method that is annotated with `@TestFactory`.

In contrast to `@Test` methods, a `@TestFactory` method is not itself a test case but
rather a factory for test cases. Thus, a dynamic test is the product of a factory.
Technically speaking, a `@TestFactory` method must return a `Stream`, `Collection`,
`Iterable`, `Iterator`, or array of `DynamicNode` instances. Instantiable subclasses of
`DynamicNode` are `DynamicContainer` and `DynamicTest`. `DynamicContainer` instances are
composed of a _display name_ and a list of dynamic child nodes, enabling the creation of
arbitrarily nested hierarchies of dynamic nodes. `DynamicTest` instances will be
executed lazily, enabling dynamic and even non-deterministic generation of test cases.
Technically speaking, a `@TestFactory` method must return a single `DynamicNode` or a
`Stream`, `Collection`, `Iterable`, `Iterator`, or array of `DynamicNode` instances.
Instantiable subclasses of `DynamicNode` are `DynamicContainer` and `DynamicTest`.
`DynamicContainer` instances are composed of a _display name_ and a list of dynamic child
nodes, enabling the creation of arbitrarily nested hierarchies of dynamic nodes.
`DynamicTest` instances will be executed lazily, enabling dynamic and even non-deterministic
generation of test cases.

Any `Stream` returned by a `@TestFactory` will be properly closed by calling
`stream.close()`, making it safe to use a resource such as `Files.lines()`.
Expand Down

0 comments on commit 5e83bfd

Please sign in to comment.