Class NamedDataGroup<Item>

  • Direct Known Subclasses:
    TestGroup

    public class NamedDataGroup<Item>
    extends java.lang.Object
    This class was created to represent a hierarchical group of items.
    Since:
    4.5
    Author:
    kir
    • Constructor Detail

      • NamedDataGroup

        public NamedDataGroup​(@NotNull
                              java.lang.String name)
        Parameters:
        name - name for the group
    • Method Detail

      • getName

        @NotNull
        public java.lang.String getName()
        Returns:
        name of the group
      • getItems

        @NotNull
        public java.util.List<Item> getItems()
      • getGroups

        @NotNull
        public java.util.List<? extends NamedDataGroup<Item>> getGroups()
        Returns:
        list of child groups (includes a group with own items, this group has an empty name)
      • getParent

        @Nullable
        public NamedDataGroup<Item> getParent()
        Returns:
        parent group (if one exists) or null for a root group
      • setParent

        public void setParent​(NamedDataGroup<Item> parent)
        Set parent group
        Parameters:
        parent - parent group for this one
      • addGroup

        public void addGroup​(NamedDataGroup<Item> group)
        Add child group
        Parameters:
        group - group to be added
      • removeGroup

        public void removeGroup​(NamedDataGroup<Item> group)
        Remove child group
        Parameters:
        group - group to be removed
      • addItem

        public void addItem​(Item item)
        Add child item
        Parameters:
        item - item to be added
      • setItems

        public void setItems​(@NotNull
                             java.util.List<Item> items)
        Set child items for the group
        Parameters:
        items - child items
      • setGroups

        public void setGroups​(java.util.List<NamedDataGroup<Item>> groups)
        Set child groups
        Parameters:
        groups - child groups
      • groupBy

        public void groupBy​(@NotNull
                            NamedDataGroup.GroupExtractor<Item> groupNameExtractor)
        Create sub-groups in this TestGroup from the containing tests using given strategy to extract groups from tests
        Parameters:
        groupNameExtractor - strategy to extract group name from the test name
        Since:
        6.5
      • sortGroups

        public void sortGroups​(java.util.Comparator<NamedDataGroup<Item>> sorter)
        Sort groups according to given sorter
        Parameters:
        sorter - sorter for the groups
        Since:
        6.5
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object