Class AbstractExtensionContext<T extends TestDescriptor>

    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • getUniqueId

        public java.lang.String getUniqueId()
        Description copied from interface: ExtensionContext
        Get the unique ID of the current test or container.
        Specified by:
        getUniqueId in interface ExtensionContext
        Returns:
        the unique ID of the test or container; never null or blank
      • getDisplayName

        public java.lang.String getDisplayName()
        Description copied from interface: ExtensionContext
        Get the display name for the current test or container.

        The display name is either a default name or a custom name configured via @DisplayName.

        For details on default display names consult the Javadoc for TestInfo.getDisplayName().

        Note that display names are typically used for test reporting in IDEs and build tools and may contain spaces, special characters, and even emoji.

        Specified by:
        getDisplayName in interface ExtensionContext
        Returns:
        the display name of the test or container; never null or blank
      • getTestDescriptor

        protected T getTestDescriptor()
      • getTags

        public java.util.Set<java.lang.String> getTags()
        Description copied from interface: ExtensionContext
        Get the set of all tags for the current test or container.

        Tags may be declared directly on the test element or inherited from an outer context.

        Specified by:
        getTags in interface ExtensionContext
        Returns:
        the set of tags for the test or container; never null but potentially empty
      • getConfigurationParameter

        public java.util.Optional<java.lang.String> getConfigurationParameter​(java.lang.String key)
        Description copied from interface: ExtensionContext
        Get the configuration parameter stored under the specified key.

        If no such key is present in the ConfigurationParameters for the JUnit Platform, an attempt will be made to look up the value as a JVM system property. If no such system property exists, an attempt will be made to look up the value in the JUnit Platform properties file.

        Specified by:
        getConfigurationParameter in interface ExtensionContext
        Parameters:
        key - the key to look up; never null or blank
        Returns:
        an Optional containing the value; never null but potentially empty
        See Also:
        System.getProperty(String), ConfigurationParameters
      • getConfigurationParameter

        public <V> java.util.Optional<V> getConfigurationParameter​(java.lang.String key,
                                                                   java.util.function.Function<java.lang.String,​V> transformer)
        Description copied from interface: ExtensionContext
        Get and transform the configuration parameter stored under the specified key using the specified transformer.

        If no such key is present in the ConfigurationParameters for the JUnit Platform, an attempt will be made to look up the value as a JVM system property. If no such system property exists, an attempt will be made to look up the value in the JUnit Platform properties file.

        In case the transformer throws an exception, it will be wrapped in a JUnitException with a helpful message.

        Specified by:
        getConfigurationParameter in interface ExtensionContext
        Parameters:
        key - the key to look up; never null or blank
        transformer - the transformer to apply in case a value is found; never null
        Returns:
        an Optional containing the value; never null but potentially empty
        See Also:
        System.getProperty(String), ConfigurationParameters