Class AbstractTestDescriptor

    • Constructor Detail

      • AbstractTestDescriptor

        protected AbstractTestDescriptor​(UniqueId uniqueId,
                                         String displayName)
        Create a new AbstractTestDescriptor with the supplied UniqueId and display name.
        Parameters:
        uniqueId - the unique ID of this TestDescriptor; never null
        displayName - the display name for this TestDescriptor; never null or blank
        See Also:
        AbstractTestDescriptor(UniqueId, String, TestSource)
      • AbstractTestDescriptor

        protected AbstractTestDescriptor​(UniqueId uniqueId,
                                         String displayName,
                                         TestSource source)
        Create a new AbstractTestDescriptor with the supplied UniqueId, display name, and source.
        Parameters:
        uniqueId - the unique ID of this TestDescriptor; never null
        displayName - the display name for this TestDescriptor; never null or blank
        source - the source of the test or container described by this TestDescriptor; can be null
        See Also:
        AbstractTestDescriptor(UniqueId, String)
    • Method Detail

      • getUniqueId

        public final UniqueId getUniqueId()
        Description copied from interface: TestDescriptor
        Get the unique identifier (UID) for this descriptor.

        Uniqueness must be guaranteed across an entire test plan, regardless of how many engines are used behind the scenes.

        Specified by:
        getUniqueId in interface TestDescriptor
        Returns:
        the UniqueId for this descriptor; never null
      • getDisplayName

        public final String getDisplayName()
        Description copied from interface: TestDescriptor
        Get the display name for this descriptor.

        A display name is a human-readable name for a test or container that is typically used for test reporting in IDEs and build tools. Display names may contain spaces, special characters, and emoji, and the format may be customized by TestEngines or potentially by end users as well. Consequently, display names should never be parsed; rather, they should be used for display purposes only.

        Specified by:
        getDisplayName in interface TestDescriptor
        Returns:
        the display name for this descriptor; never null or blank
        See Also:
        TestDescriptor.getSource()
      • getTags

        public Set<TestTag> getTags()
        Description copied from interface: TestDescriptor
        Get the set of tags associated with this descriptor.
        Specified by:
        getTags in interface TestDescriptor
        Returns:
        the set of tags associated with this descriptor; never null but potentially empty
        See Also:
        TestTag
      • setParent

        public final void setParent​(TestDescriptor parent)
        Description copied from interface: TestDescriptor
        Set the parent of this descriptor.
        Specified by:
        setParent in interface TestDescriptor
        Parameters:
        parent - the new parent of this descriptor; may be null.
      • addChild

        public void addChild​(TestDescriptor child)
        Description copied from interface: TestDescriptor
        Add a child to this descriptor.
        Specified by:
        addChild in interface TestDescriptor
        Parameters:
        child - the child to add to this descriptor; never null
      • removeChild

        public void removeChild​(TestDescriptor child)
        Description copied from interface: TestDescriptor
        Remove a child from this descriptor.
        Specified by:
        removeChild in interface TestDescriptor
        Parameters:
        child - the child to remove from this descriptor; never null
      • removeFromHierarchy

        public void removeFromHierarchy()
        Description copied from interface: TestDescriptor
        Remove this non-root descriptor from its parent and remove all the children from this descriptor.

        If this method is invoked on a root descriptor, this method must throw a JUnitException explaining that a root cannot be removed from the hierarchy.

        Specified by:
        removeFromHierarchy in interface TestDescriptor
      • findByUniqueId

        public Optional<? extends TestDescriptor> findByUniqueId​(UniqueId uniqueId)
        Description copied from interface: TestDescriptor
        Find the descriptor with the supplied unique ID.

        The search algorithm begins with this descriptor and then searches through its descendants.

        Specified by:
        findByUniqueId in interface TestDescriptor
        Parameters:
        uniqueId - the UniqueId to search for; never null
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public final boolean equals​(Object other)
        Overrides:
        equals in class Object