Class Utils


  • public class Utils
    extends java.lang.Object
    Utility class for static methods
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Map<io.cucumber.plugin.event.Status,​java.lang.String> LOG_LEVEL_MAPPING  
      static java.util.Map<io.cucumber.plugin.event.Status,​com.epam.reportportal.listeners.ItemStatus> STATUS_MAPPING  
      static java.lang.String TAG_KEY  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String buildName​(java.lang.String prefix, java.lang.String infix, java.lang.String argument)
      Generate name representation
      static java.lang.String formatParameters​(java.util.List<org.apache.commons.lang3.tuple.Pair<java.lang.String,​java.lang.String>> parameters)
      Format a list of parameters into a string representation to use in code reference and Test Case ID.
      static java.lang.String getDataType​(byte[] data, java.lang.String name)
      Detects the MIME type of the given byte array using the MimeTypeDetector.
      static java.util.Set<java.lang.String> getTags​(io.cucumber.core.gherkin.Feature feature)
      Parses a feature source and return all declared tags before the feature.
      static java.util.Set<java.lang.String> getTags​(io.cucumber.plugin.event.Node.Rule rule)
      Parses a rule source and return all declared tags before the rule.
      static com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ toAttribute​(java.lang.String tag)
      Convert a tag string to a ReportPortal attribute, split by key-value separator ":" if present.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • STATUS_MAPPING

        public static final java.util.Map<io.cucumber.plugin.event.Status,​com.epam.reportportal.listeners.ItemStatus> STATUS_MAPPING
      • LOG_LEVEL_MAPPING

        public static final java.util.Map<io.cucumber.plugin.event.Status,​java.lang.String> LOG_LEVEL_MAPPING
    • Method Detail

      • buildName

        public static java.lang.String buildName​(@Nullable
                                                 java.lang.String prefix,
                                                 @Nullable
                                                 java.lang.String infix,
                                                 @Nullable
                                                 java.lang.String argument)
        Generate name representation
        Parameters:
        prefix - - substring to be prepended at the beginning (optional)
        infix - - substring to be inserted between keyword and name
        argument - - main text to process
        Returns:
        transformed string
      • getTags

        @Nonnull
        public static java.util.Set<java.lang.String> getTags​(@Nonnull
                                                              io.cucumber.core.gherkin.Feature feature)
        Parses a feature source and return all declared tags before the feature.
        Parameters:
        feature - Cucumber's Feature object
        Returns:
        tags set
      • getTags

        @Nonnull
        public static java.util.Set<java.lang.String> getTags​(@Nonnull
                                                              io.cucumber.plugin.event.Node.Rule rule)
        Parses a rule source and return all declared tags before the rule.
        Parameters:
        rule - Cucumber's Rule object
        Returns:
        tags set
      • toAttribute

        public static com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ toAttribute​(java.lang.String tag)
        Convert a tag string to a ReportPortal attribute, split by key-value separator ":" if present.
        Parameters:
        tag - tag string
        Returns:
        attribute object
      • formatParameters

        @Nonnull
        public static java.lang.String formatParameters​(@Nonnull
                                                        java.util.List<org.apache.commons.lang3.tuple.Pair<java.lang.String,​java.lang.String>> parameters)
        Format a list of parameters into a string representation to use in code reference and Test Case ID.
        Parameters:
        parameters - list of parameters as key-value pairs
        Returns:
        formatted string representation of parameters
      • getDataType

        @Nullable
        public static java.lang.String getDataType​(@Nonnull
                                                   byte[] data,
                                                   @Nullable
                                                   java.lang.String name)
        Detects the MIME type of the given byte array using the MimeTypeDetector.
        Parameters:
        data - the byte array to analyze
        name - an optional name to help with detection (can be null)
        Returns:
        the detected MIME type as a String, or null if detection fails