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 theTestInstanceFactoryContextAPI.- Since:
- 5.3
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Optional<java.lang.Object>outerInstanceprivate 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.StringtoString()
-
-
-
Method Detail
-
getTestClass
public java.lang.Class<?> getTestClass()
Description copied from interface:TestInstanceFactoryContextGet the test class for this context.- Specified by:
getTestClassin interfaceTestInstanceFactoryContext- Returns:
- the test class to be instantiated; never
null
-
getOuterInstance
public java.util.Optional<java.lang.Object> getOuterInstance()
Description copied from interface:TestInstanceFactoryContextGet the instance of the outer class, if available.The returned
Optionalwill be empty unless the current test class is a@Nestedtest class.- Specified by:
getOuterInstancein interfaceTestInstanceFactoryContext- Returns:
- an
Optionalcontaining the outer test instance; nevernullbut potentially empty - See Also:
Nested
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-