Class DefaultTestInstanceFactoryContext

    • 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()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • testClass

        private final java.lang.Class<?> testClass
      • outerInstance

        private final java.util.Optional<java.lang.Object> outerInstance
    • Constructor Detail

      • DefaultTestInstanceFactoryContext

        DefaultTestInstanceFactoryContext​(java.lang.Class<?> testClass,
                                          java.util.Optional<java.lang.Object> outerInstance)
    • Method Detail

      • 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 interface TestInstanceFactoryContext
        Returns:
        an Optional containing the outer test instance; never null but potentially empty
        See Also:
        Nested
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object