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
-
Method Summary
Modifier and TypeMethodDescriptionAdd the coverage from the specified instance to the coverage of this instance.org.apache.commons.lang3.math.Fraction
Computes the delta of this value with the specified value.boolean
int
Returns the number of covered items.Returns the percentage of covered items.int
Returns the number of missed items.int
getTotal()
int
hashCode()
boolean
isOutOfValidRange
(double threshold) Returns whether this coverage percentage is below the given threshold.boolean
isSet()
Merge this coverage with the specified coverage.static Coverage
nullObject
(Metric metric) Returns anull
object that indicates that no coverage has been recorded.Serializes this instance into a String.toString()
static Coverage
Creates a newCoverage
instance from the provided string representation.
-
Method Details
-
valueOf
Creates a newCoverage
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.- 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 anull
object that indicates that no coverage has been recorded.- Parameters:
metric
- the coverage metric- Returns:
- the
null
object
-
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.,total
is 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:Value
Add the coverage from the specified instance to the coverage of this instance. -
delta
Description copied from class:Value
Computes the delta of this value with the specified value. -
max
Description copied from class:Value
Merge 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:
isOutOfValidRange
in 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:Value
Serializes this instance into a String.
-