TestInstances
encapsulates the test instances of a test.
While top-level tests only have a single test instance, nested tests have one additional instance for each enclosing test class.
ExtensionContext#getTestInstances()
, ExtensionContext#getRequiredTestInstances()
Modifier and Type | Method and Description |
---|---|
public <T> Optional | Returns: the first test instance of the required type; nevernull
but potentially emptythe type to search for requiredType)Find the first test instance that is an instance of the supplied required type, checking from innermost to outermost. |
public List | Returns: all test instances; nevernull , containing null ,
or emptyGet all test instances, ordered from outermost to innermost. |
public List | Returns: the enclosing test instances; nevernull or containing
null , but potentially emptyGet the enclosing test instances, excluding the innermost test instance, ordered from outermost to innermost. |
public Object | Returns: the innermost test instance; nevernull Get the innermost test instance. |
findInstance | back to summary |
---|---|
public <T> Optional Find the first test instance that is an instance of the supplied required type, checking from innermost to outermost. |
getAllInstances | back to summary |
---|---|
public List Get all test instances, ordered from outermost to innermost. |
getEnclosingInstances | back to summary |
---|---|
public List Get the enclosing test instances, excluding the innermost test instance, ordered from outermost to innermost. |
getInnermostInstance | back to summary |
---|---|
public Object getInnermostInstance() Get the innermost test instance. The innermost instance is the one closest to the test method.
|