Module org.junit.jupiter.engine
Class DefaultTestInstances
java.lang.Object
org.junit.jupiter.engine.execution.DefaultTestInstances
- All Implemented Interfaces:
TestInstances
-
Method Summary
Modifier and TypeMethodDescription<T> Optional<T>
findInstance(Class<T> requiredType)
Find the first test instance that is an instance of the supplied required type, checking from innermost to outermost.Get all test instances, ordered from outermost to innermost.Get the enclosing test instances, excluding the innermost test instance, ordered from outermost to innermost.Get the innermost test instance.static DefaultTestInstances
static DefaultTestInstances
of(TestInstances testInstances, Object instance)
-
Method Details
-
of
-
of
-
getInnermostInstance
Description copied from interface:TestInstances
Get the innermost test instance.The innermost instance is the one closest to the test method.
- Specified by:
getInnermostInstance
in interfaceTestInstances
- Returns:
- the innermost test instance; never
null
-
getEnclosingInstances
Description copied from interface:TestInstances
Get the enclosing test instances, excluding the innermost test instance, ordered from outermost to innermost.- Specified by:
getEnclosingInstances
in interfaceTestInstances
- Returns:
- the enclosing test instances; never
null
or containingnull
, but potentially empty
-
getAllInstances
Description copied from interface:TestInstances
Get all test instances, ordered from outermost to innermost.- Specified by:
getAllInstances
in interfaceTestInstances
- Returns:
- all test instances; never
null
, containingnull
, or empty
-
findInstance
Description copied from interface:TestInstances
Find the first test instance that is an instance of the supplied required type, checking from innermost to outermost.- Specified by:
findInstance
in interfaceTestInstances
- Parameters:
requiredType
- the type to search for- Returns:
- the first test instance of the required type; never
null
but potentially empty
-