Package com.epam.reportportal.cucumber
Class Utils
- java.lang.Object
-
- com.epam.reportportal.cucumber.Utils
-
public class Utils extends java.lang.ObjectUtility 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_MAPPINGstatic java.util.Map<io.cucumber.plugin.event.Status,com.epam.reportportal.listeners.ItemStatus>STATUS_MAPPINGstatic java.lang.StringTAG_KEY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringbuildName(java.lang.String prefix, java.lang.String infix, java.lang.String argument)Generate name representationstatic java.lang.StringformatParameters(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.StringgetDataType(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.ItemAttributesRQtoAttribute(java.lang.String tag)Convert a tag string to a ReportPortal attribute, split by key-value separator ":" if present.
-
-
-
Field Detail
-
TAG_KEY
public static final java.lang.String TAG_KEY
- See Also:
- Constant Field Values
-
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 nameargument- - 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 analyzename- an optional name to help with detection (can be null)- Returns:
- the detected MIME type as a String, or null if detection fails
-
-