Klasse Coverage

java.lang.Object
io.jenkins.plugins.coverage.model.Coverage
Alle implementierten Schnittstellen:
Serializable

public final class Coverage extends Object implements Serializable
Value of a code coverage item. The code coverage is measured using the number of covered and missed items. The type of items (line, instruction, branch, file, etc.) is provided by the companion class CoverageMetric.
Autor:
Ullrich Hafner
Siehe auch:
  • Felddetails

    • NO_COVERAGE

      public static final Coverage NO_COVERAGE
      Null object that indicates that the code coverage has not been measured.
  • Methodendetails

    • valueOf

      public static Coverage valueOf(String stringRepresentation)
      Creates a new Coverage instance from the provided string representation. The string representation is expected to contain the number of covered items and the total number of items - separated by a slash, e.g. "100/345", or "0/0". Whitespace characters will be ignored.
      Parameter:
      stringRepresentation - string representation to convert from
      Gibt zurück:
      the created coverage
      Löst aus:
      IllegalArgumentException - if the string is not a valid Coverage instance
    • getCovered

      public int getCovered()
      Returns the number of covered items.
      Gibt zurück:
      the number of covered items
    • getCoveredFraction

      public org.apache.commons.lang3.math.Fraction getCoveredFraction()
      Returns the covered percentage as a Fraction in the range of [0, 1].
      Gibt zurück:
      the covered percentage
    • getCoveredPercentage

      public CoveragePercentage getCoveredPercentage()
      Returns the covered percentage as a CoveragePercentage in the range of [0, 100].
      Gibt zurück:
      the covered percentage
    • getRoundedPercentage

      public int getRoundedPercentage()
      Returns the covered percentage as rounded integer value in the range of [0, 100].
      Gibt zurück:
      the covered percentage
    • formatCoveredPercentage

      public String formatCoveredPercentage()
      Formats the covered percentage as String (with a precision of two digits after the comma). Uses Locale.getDefault() to format the percentage.
      Gibt zurück:
      the covered percentage
      Siehe auch:
    • formatCoveredPercentage

      public String formatCoveredPercentage(Locale locale)
      Formats the covered percentage as String (with a precision of two digits after the comma).
      Parameter:
      locale - the locale to use when formatting the percentage
      Gibt zurück:
      the covered percentage
    • getMissed

      public int getMissed()
      Returns the number of missed items.
      Gibt zurück:
      the number of missed items
    • getMissedFraction

      public org.apache.commons.lang3.math.Fraction getMissedFraction()
      Returns the missed percentage as a Fraction in the range of [0, 1].
      Gibt zurück:
      the missed percentage
    • getMissedPercentage

      public CoveragePercentage getMissedPercentage()
      Returns the missed percentage as a CoveragePercentage in the range of [0, 100].
      Gibt zurück:
      the missed percentage
    • formatMissedPercentage

      public String formatMissedPercentage()
      Formats the missed percentage as formatted String (with a precision of two digits after the comma). Uses Locale.getDefault() to format the percentage.
      Gibt zurück:
      the missed percentage
    • formatMissedPercentage

      public String formatMissedPercentage(Locale locale)
      Formats the missed percentage as formatted String (with a precision of two digits after the comma).
      Parameter:
      locale - the locale to use when formatting the percentage
      Gibt zurück:
      the missed percentage
    • add

      public Coverage add(Coverage additional)
      Add the coverage details from the specified instance to the coverage details of this instance.
      Parameter:
      additional - the additional coverage details
      Gibt zurück:
      the sum of this and the additional coverage
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object
    • getTotal

      public int getTotal()
    • isSet

      public boolean isSet()
    • equals

      public boolean equals(Object o)
      Setzt außer Kraft:
      equals in Klasse Object
    • hashCode

      public int hashCode()
      Setzt außer Kraft:
      hashCode in Klasse Object
    • serializeToString

      public String serializeToString()
      Returns a string representation for this Coverage that can be used to serialize this instance in a simple but still readable way. The serialization contains the number of covered items and the total number of items - separated by a slash, e.g. "100/345", or "0/0".
      Gibt zurück:
      a string representation for this Coverage