Class DynamicContainer

java.lang.Object
org.junit.jupiter.api.DynamicNode
org.junit.jupiter.api.DynamicContainer

@API(status=MAINTAINED,
     since="5.3")
public class DynamicContainer
extends DynamicNode
A DynamicContainer is a container generated at runtime.

It is composed of a display name and an Iterable or Stream of DynamicNodes.

Instances of DynamicContainer must be generated by factory methods annotated with @TestFactory.

Since:
5.0
See Also:
dynamicContainer(String, Iterable), dynamicContainer(String, Stream), TestFactory, DynamicTest
  • Method Summary

    Modifier and Type Method Description
    static DynamicContainer dynamicContainer​(java.lang.String displayName, java.lang.Iterable<? extends DynamicNode> dynamicNodes)
    Factory for creating a new DynamicContainer for the supplied display name and collection of dynamic nodes.
    static DynamicContainer dynamicContainer​(java.lang.String displayName, java.net.URI testSourceUri, java.util.stream.Stream<? extends DynamicNode> dynamicNodes)
    Factory for creating a new DynamicContainer for the supplied display name, custom test source URI, and stream of dynamic nodes.
    static DynamicContainer dynamicContainer​(java.lang.String displayName, java.util.stream.Stream<? extends DynamicNode> dynamicNodes)
    Factory for creating a new DynamicContainer for the supplied display name and stream of dynamic nodes.
    java.util.stream.Stream<? extends DynamicNode> getChildren()
    Get the Stream of DynamicNodes associated with this DynamicContainer.

    Methods inherited from class org.junit.jupiter.api.DynamicNode

    getDisplayName, getTestSourceUri, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • dynamicContainer

      public static DynamicContainer dynamicContainer​(java.lang.String displayName, java.lang.Iterable<? extends DynamicNode> dynamicNodes)
      Factory for creating a new DynamicContainer for the supplied display name and collection of dynamic nodes.

      The collection of dynamic nodes must not contain null elements.

      Parameters:
      displayName - the display name for the dynamic container; never null or blank
      dynamicNodes - collection of dynamic nodes to execute; never null
      See Also:
      dynamicContainer(String, Stream)
    • dynamicContainer

      public static DynamicContainer dynamicContainer​(java.lang.String displayName, java.util.stream.Stream<? extends DynamicNode> dynamicNodes)
      Factory for creating a new DynamicContainer for the supplied display name and stream of dynamic nodes.

      The stream of dynamic nodes must not contain null elements.

      Parameters:
      displayName - the display name for the dynamic container; never null or blank
      dynamicNodes - stream of dynamic nodes to execute; never null
      See Also:
      dynamicContainer(String, Iterable)
    • dynamicContainer

      public static DynamicContainer dynamicContainer​(java.lang.String displayName, java.net.URI testSourceUri, java.util.stream.Stream<? extends DynamicNode> dynamicNodes)
      Factory for creating a new DynamicContainer for the supplied display name, custom test source URI, and stream of dynamic nodes.

      The stream of dynamic nodes must not contain null elements.

      Parameters:
      displayName - the display name for the dynamic container; never null or blank
      testSourceUri - a custom test source URI for the dynamic container; may be null if the framework should generate the test source based on the @TestFactory method
      dynamicNodes - stream of dynamic nodes to execute; never null
      Since:
      5.3
      See Also:
      dynamicContainer(String, Iterable)
    • getChildren

      public java.util.stream.Stream<? extends DynamicNode> getChildren()
      Get the Stream of DynamicNodes associated with this DynamicContainer.