Class ReporterTestUtils

java.lang.Object
org.apache.rat.ReporterTestUtils

public final class ReporterTestUtils extends Object
Utilities to help analyze report test output.
  • Field Details

    • UNKNOWN_LICENSE

      public static final String UNKNOWN_LICENSE
      The default license output for an unknown license
    • APACHE_LICENSE

      public static final String APACHE_LICENSE
      The default license output for an Apache 2 license
  • Method Details

    • documentOut

      public static String documentOut(boolean approved, Document.Type type, String name)
      Generates the regex string for a document output line. Suitable for regex query.
      Parameters:
      approved - True if this license is approved
      type - The document type.
      name - The name of the document.
      Returns:
      the regular expression string representing the document.
    • licenseOut

      public static String licenseOut(String family, String name)
      Generates the regex string for a license output line. Suitable for regex query.
      Parameters:
      family - The license family category.
      name - The license name.
      Returns:
      the regular expression string representing the license.
    • licenseOut

      public static String licenseOut(String family, String id, String name)
      Generates the regex string for a license output line. Suitable for regex query.
      Parameters:
      family - The license family category.
      id - The license id if different from family.
      name - The license name.
      Returns:
      the regular expression string representing the license.
    • counterText

      public static String counterText(ClaimStatistic.Counter counter, int count, boolean error)
      Renders report contents of a given counter value, including handling of negation.
      Parameters:
      counter - The expected type of counter in the report.
      count - The expected number of occurrences of the given counter.
      error - True if the counter does exceed a minimum or maximum value.
      Returns:
      the report contents of the given counter.
    • apacheLicenseVersion2

      public static String apacheLicenseVersion2(int count)
      Generates the report contents for Apache 2.0 licenses.
      Parameters:
      count - The expected number of occurrences of the license.
      Returns:
      Report contents for Apache 2.0 licenses in the report.
    • unknownLicense

      public static String unknownLicense(int count)
      Generates the report contents for unknown licenses.
      Parameters:
      count - The expected number of occurrences of the license.
      Returns:
      Report contents for unknown licenses in the report.