Top Description Methods
org.junit.jupiter.api.extension

public Interface TestInstanceFactoryContext

Annotations
@API
status:STABLE
since:5.7
Static Imports
org.apiguardian.api.API.Status.STABLE

TestInstanceFactoryContext encapsulates the context in which a test class is to be instantiated by a TestInstanceFactory.
Since
5.3
See Also
TestInstanceFactory

Method Summary

Modifier and TypeMethod and Description
public Optional<Object>

Returns:

an Optional containing the outer test instance; never null but potentially empty
getOuterInstance
()

Get the instance of the outer class, if available.

public Class<?>

Returns:

the test class to be instantiated; never null
getTestClass
()

Get the test class for this context.

Method Detail

getOuterInstanceback to summary
public Optional<Object> getOuterInstance()

Get the instance of the outer class, if available.

The returned Optional will be empty unless the current test class is a @Nested test class.

Returns:Optional<Object>

an Optional containing the outer test instance; never null but potentially empty

See Also
org.junit.jupiter.api.Nested
getTestClassback to summary
public Class<?> getTestClass()

Get the test class for this context.

Returns:Class<?>

the test class to be instantiated; never null