Class Scope

java.lang.Object
io.micronaut.testresources.core.Scope

public final class Scope extends Object
A scope represents the lifecycle of a test resource. The root scope is handled by the test resources provider, and lives as long as the provider is alive, or that it is explicitly closed. The scope property is always implicitly requested.
  • Field Details

    • ROOT

      public static final Scope ROOT
      The default scope.
    • PROPERTY_KEY

      public static final String PROPERTY_KEY
      The property name, for when the scope is passed as a property string.
      See Also:
  • Method Details

    • from

      public static Scope from(Map<String,Object> properties)
      Returns the scope id if found in the supplied properties.
      Parameters:
      properties - the properties where to look for the scope
      Returns:
      the scope
    • child

      public Scope child(String id)
      Creates a child scope with the given id.
      Parameters:
      id - the child id
      Returns:
      the child scope
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Object
    • includes

      public boolean includes(Scope scope)
      Determines if this scope is the supplied scope, or the parent of the supplied scope.
      Parameters:
      scope - the scope to check
      Returns:
      true if this scope includes the supplied scope
    • of

      public static Scope of(String id)
      Returns a new scope with the given id.
      Parameters:
      id - the scope id
      Returns:
      the scope