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 DefaultTestInstancesstatic DefaultTestInstancesof(TestInstances testInstances, Object instance)
-
Method Details
-
of
-
of
-
getInnermostInstance
Description copied from interface:TestInstancesGet the innermost test instance.The innermost instance is the one closest to the test method.
- Specified by:
getInnermostInstancein interfaceTestInstances- Returns:
- the innermost test instance; never
null
-
getEnclosingInstances
Description copied from interface:TestInstancesGet the enclosing test instances, excluding the innermost test instance, ordered from outermost to innermost.- Specified by:
getEnclosingInstancesin interfaceTestInstances- Returns:
- the enclosing test instances; never
nullor containingnull, but potentially empty
-
getAllInstances
Description copied from interface:TestInstancesGet all test instances, ordered from outermost to innermost.- Specified by:
getAllInstancesin interfaceTestInstances- Returns:
- all test instances; never
null, containingnull, or empty
-
findInstance
Description copied from interface:TestInstancesFind the first test instance that is an instance of the supplied required type, checking from innermost to outermost.- Specified by:
findInstancein interfaceTestInstances- Parameters:
requiredType- the type to search for- Returns:
- the first test instance of the required type; never
nullbut potentially empty
-