Class Coverage
java.lang.Object
com.parasoft.findings.jenkins.coverage.model.Value
com.parasoft.findings.jenkins.coverage.model.Coverage
- All Implemented Interfaces:
Serializable
Value of a code coverage metric. The code coverage is measured using the number of covered and missed items. The type
of items (line, instruction, branch, mutation, file, etc.) is provided by the companion class
Metric.- Author:
- Ullrich Hafner
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionAdd the coverage from the specified instance to the coverage of this instance.org.apache.commons.lang3.math.FractionComputes the delta of this value with the specified value.booleanintReturns the number of covered items.Returns the percentage of covered items.intReturns the number of missed items.intgetTotal()inthashCode()booleanisOutOfValidRange(double threshold) Returns whether this coverage percentage is below the given threshold.booleanisSet()Merge this coverage with the specified coverage.static CoveragenullObject(Metric metric) Returns anullobject that indicates that no coverage has been recorded.Serializes this instance into a String.toString()static CoverageCreates a newCoverageinstance from the provided string representation.
-
Method Details
-
valueOf
Creates a newCoverageinstance 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.- Parameters:
metric- the coverage metric of this instancestringRepresentation- string representation to convert from- Returns:
- the created coverage
- Throws:
IllegalArgumentException- if the string is not a valid Coverage instance
-
nullObject
Returns anullobject that indicates that no coverage has been recorded.- Parameters:
metric- the coverage metric- Returns:
- the
nullobject
-
getCovered
public int getCovered()Returns the number of covered items.- Returns:
- the number of covered items
-
getCoveredPercentage
Returns the percentage of covered items. If this coverage is undefined (i.e.,totalis zero) then zero will be returned.- Returns:
- the covered percentage
-
getMissed
public int getMissed()Returns the number of missed items.- Returns:
- the number of missed items
-
add
Description copied from class:ValueAdd the coverage from the specified instance to the coverage of this instance. -
delta
Description copied from class:ValueComputes the delta of this value with the specified value. -
max
Description copied from class:ValueMerge this coverage with the specified coverage. -
isOutOfValidRange
public boolean isOutOfValidRange(double threshold) Returns whether this coverage percentage is below the given threshold. The threshold must be a percentage in the range of [0, 100].- Specified by:
isOutOfValidRangein classValue- Parameters:
threshold- the threshold in the range of [0, 100]- Returns:
true, if this value is below the specified threshold
-
getTotal
public int getTotal() -
isSet
public boolean isSet() -
equals
-
hashCode
public int hashCode() -
toString
-
serialize
Description copied from class:ValueSerializes this instance into a String.
-