@API(status=INTERNAL,
since="5.4")
public class DefaultTestInstances
extends Object
implements TestInstances
| Modifier and Type | Method and Description |
|---|---|
<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.
|
List<Object> |
getAllInstances()
Get all test instances, ordered from outermost to innermost.
|
List<Object> |
getEnclosingInstances()
Get the enclosing test instances, excluding the innermost test instance,
ordered from outermost to innermost.
|
Object |
getInnermostInstance()
Get the innermost test instance.
|
static DefaultTestInstances |
of(Object instance) |
static DefaultTestInstances |
of(TestInstances testInstances,
Object instance) |
public static DefaultTestInstances of(Object instance)
public static DefaultTestInstances of(TestInstances testInstances, Object instance)
public Object getInnermostInstance()
TestInstancesThe innermost instance is the one closest to the test method.
getInnermostInstance in interface TestInstancesnullpublic List<Object> getEnclosingInstances()
TestInstancesgetEnclosingInstances in interface TestInstancesnull or containing
null, but potentially emptypublic List<Object> getAllInstances()
TestInstancesgetAllInstances in interface TestInstancesnull, containing null,
or emptypublic <T> Optional<T> findInstance(Class<T> requiredType)
TestInstancesfindInstance in interface TestInstancesrequiredType - the type to search fornull
but potentially emptyCopyright © 2024. All rights reserved.