Class ExtensionContext.Namespace

java.lang.Object
org.junit.jupiter.api.extension.ExtensionContext.Namespace
Enclosing interface:
ExtensionContext

public static class ExtensionContext.Namespace extends Object
A Namespace is used to provide a scope for data saved by extensions within a ExtensionContext.Store.

Storing data in custom namespaces allows extensions to avoid accidentally mixing data between extensions or across different invocations within the lifecycle of a single extension.

  • Field Details

    • GLOBAL

      public static final ExtensionContext.Namespace GLOBAL
      The default, global namespace which allows access to stored data from all extensions.
  • Method Details

    • create

      public static ExtensionContext.Namespace create(Object... parts)
      Create a namespace which restricts access to data to all extensions which use the same sequence of parts for creating a namespace.

      The order of the parts is significant.

      Internally the parts are compared using Object.equals(Object).

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • append

      @API(status=STABLE, since="5.10") public ExtensionContext.Namespace append(Object... parts)
      Create a new namespace by appending the supplied parts to the existing sequence of parts in this namespace.
      Returns:
      new namespace; never null
      Since:
      5.8