Interface TestInstances

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method 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.
    • Method Detail

      • getInnermostInstance

        java.lang.Object getInnermostInstance()
        Get the innermost test instance.

        The innermost instance is the one closest to the test method.

        Returns:
        the innermost test instance; never null
      • getEnclosingInstances

        java.util.List<java.lang.Object> getEnclosingInstances()
        Get the enclosing test instances, excluding the innermost test instance, ordered from outermost to innermost.
        Returns:
        the enclosing test instances; never null or containing null, but potentially empty
      • getAllInstances

        java.util.List<java.lang.Object> getAllInstances()
        Get all test instances, ordered from outermost to innermost.
        Returns:
        all test instances; never null, containing null, or empty
      • findInstance

        <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.
        Parameters:
        requiredType - the type to search for
        Returns:
        the first test instance of the required type; never null but potentially empty