@API(status=INTERNAL,
since="5.4")
public class DefaultTestInstances
extends java.lang.Object
implements TestInstances
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<java.lang.Object> |
instances |
| Modifier | Constructor and Description |
|---|---|
private |
DefaultTestInstances(java.util.List<java.lang.Object> instances) |
| Modifier and Type | Method and Description |
|---|---|
<T> java.util.Optional<T> |
findInstance(java.lang.Class<T> requiredType)
Find the first test instance that is an instance of the supplied required
type, checking from innermost to outermost.
|
java.util.List<java.lang.Object> |
getAllInstances()
Get all test instances, ordered from outermost to innermost.
|
java.util.List<java.lang.Object> |
getEnclosingInstances()
Get the enclosing test instances, excluding the innermost test instance,
ordered from outermost to innermost.
|
java.lang.Object |
getInnermostInstance()
Get the innermost test instance.
|
static DefaultTestInstances |
of(java.lang.Object instance) |
static DefaultTestInstances |
of(TestInstances testInstances,
java.lang.Object instance) |
private DefaultTestInstances(java.util.List<java.lang.Object> instances)
public static DefaultTestInstances of(java.lang.Object instance)
public static DefaultTestInstances of(TestInstances testInstances, java.lang.Object instance)
public java.lang.Object getInnermostInstance()
TestInstancesThe innermost instance is the one closest to the test method.
getInnermostInstance in interface TestInstancesnullpublic java.util.List<java.lang.Object> getEnclosingInstances()
TestInstancesgetEnclosingInstances in interface TestInstancesnull or containing
null, but potentially emptypublic java.util.List<java.lang.Object> getAllInstances()
TestInstancesgetAllInstances in interface TestInstancesnull, containing null,
or emptypublic <T> java.util.Optional<T> findInstance(java.lang.Class<T> requiredType)
TestInstancesfindInstance in interface TestInstancesrequiredType - the type to search fornull
but potentially empty