Module org.junit.jupiter.engine
Class DefaultTestInstanceFactoryContext
- java.lang.Object
-
- org.junit.jupiter.engine.descriptor.DefaultTestInstanceFactoryContext
-
- All Implemented Interfaces:
TestInstanceFactoryContext
class DefaultTestInstanceFactoryContext extends java.lang.Object implements TestInstanceFactoryContext
Default implementation of theTestInstanceFactoryContext
API.- Since:
- 5.3
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Optional<java.lang.Object>
outerInstance
private java.lang.Class<?>
testClass
-
Constructor Summary
Constructors Constructor Description DefaultTestInstanceFactoryContext(java.lang.Class<?> testClass, java.util.Optional<java.lang.Object> outerInstance)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<java.lang.Object>
getOuterInstance()
Get the instance of the outer class, if available.java.lang.Class<?>
getTestClass()
Get the test class for this context.java.lang.String
toString()
-
-
-
Method Detail
-
getTestClass
public java.lang.Class<?> getTestClass()
Description copied from interface:TestInstanceFactoryContext
Get the test class for this context.- Specified by:
getTestClass
in interfaceTestInstanceFactoryContext
- Returns:
- the test class to be instantiated; never
null
-
getOuterInstance
public java.util.Optional<java.lang.Object> getOuterInstance()
Description copied from interface:TestInstanceFactoryContext
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.- Specified by:
getOuterInstance
in interfaceTestInstanceFactoryContext
- Returns:
- an
Optional
containing the outer test instance; nevernull
but potentially empty - See Also:
Nested
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-