Class MarkdownUtils


  • public class MarkdownUtils
    extends java.lang.Object
    Set helpful of utility methods for reporting to ReportPortal
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String asCode​(java.lang.String language, java.lang.String script)
      Builds markdown representation of some script to be logged to ReportPortal
      static java.lang.String asMarkdown​(java.lang.String message)
      Adds special prefix to make log message being processed as markdown
      static java.lang.String asTwoParts​(java.lang.String firstPart, java.lang.String secondPart)  
      static java.lang.String formatDataTable​(java.util.List<java.util.List<java.lang.String>> table)
      Converts a table represented as List of Lists to a formatted table string.
      static java.lang.String formatDataTable​(java.util.List<java.util.List<java.lang.String>> table, int maxTableSize)
      Converts a table represented as List of Lists to a formatted table string.
      static java.lang.String formatDataTable​(java.util.Map<java.lang.String,​java.lang.String> table)
      Converts a table represented as Map to a formatted table string.
      • Methods inherited from class java.lang.Object

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

      • asMarkdown

        @Nonnull
        public static java.lang.String asMarkdown​(@Nonnull
                                                  java.lang.String message)
        Adds special prefix to make log message being processed as markdown
        Parameters:
        message - Message
        Returns:
        Message with markdown marker
      • asCode

        @Nonnull
        public static java.lang.String asCode​(@Nullable
                                              java.lang.String language,
                                              @Nullable
                                              java.lang.String script)
        Builds markdown representation of some script to be logged to ReportPortal
        Parameters:
        language - Script language
        script - Script
        Returns:
        Message to be sent to ReportPortal
      • formatDataTable

        @Nonnull
        public static java.lang.String formatDataTable​(@Nonnull
                                                       java.util.List<java.util.List<java.lang.String>> table,
                                                       int maxTableSize)
        Converts a table represented as List of Lists to a formatted table string.
        Parameters:
        table - a table object
        maxTableSize - maximum size in characters of result table, cells will be truncated
        Returns:
        string representation of the table
      • formatDataTable

        @Nonnull
        public static java.lang.String formatDataTable​(@Nonnull
                                                       java.util.List<java.util.List<java.lang.String>> table)
        Converts a table represented as List of Lists to a formatted table string.
        Parameters:
        table - a table object
        Returns:
        string representation of the table
      • formatDataTable

        @Nonnull
        public static java.lang.String formatDataTable​(@Nonnull
                                                       java.util.Map<java.lang.String,​java.lang.String> table)
        Converts a table represented as Map to a formatted table string.
        Parameters:
        table - a table object
        Returns:
        string representation of the table
      • asTwoParts

        @Nonnull
        public static java.lang.String asTwoParts​(@Nonnull
                                                  java.lang.String firstPart,
                                                  @Nonnull
                                                  java.lang.String secondPart)