@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()
TestInstances
The innermost instance is the one closest to the test method.
getInnermostInstance
in interface TestInstances
null
public java.util.List<java.lang.Object> getEnclosingInstances()
TestInstances
getEnclosingInstances
in interface TestInstances
null
or containing
null
, but potentially emptypublic java.util.List<java.lang.Object> getAllInstances()
TestInstances
getAllInstances
in interface TestInstances
null
, containing null
,
or emptypublic <T> java.util.Optional<T> findInstance(java.lang.Class<T> requiredType)
TestInstances
findInstance
in interface TestInstances
requiredType
- the type to search fornull
but potentially empty