Package org.jacoco.report.check
Class Limit
java.lang.Object
org.jacoco.report.check.Limit
Descriptor for a limit which is given by a
Rule
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ICoverageNode.CounterEntity
private static final Map
<ICoverageNode.CounterEntity, String> private BigDecimal
private BigDecimal
private ICounter.CounterValue
private static final Map
<ICounter.CounterValue, String> -
Constructor Summary
ConstructorsConstructorDescriptionLimit()
Creates a new instance with the following defaults: counter entity:ICoverageNode.CounterEntity.INSTRUCTION
counter value:ICounter.CounterValue.COVEREDRATIO
minimum: no limit maximum: no limit -
Method Summary
Modifier and TypeMethodDescription(package private) String
check
(ICoverageNode node) private String
private String
checkRatioLimit
(String minmax, BigDecimal v) getValue()
private String
message
(String minmax, BigDecimal v, BigDecimal ref, RoundingMode mode) private static BigDecimal
parseValue
(String value) void
setCounter
(String entity) Sets the counter entity to check.void
setMaximum
(String maximum) Sets the expected maximum value.void
setMinimum
(String minimum) Sets the expected minimum value.void
Sets the value to check.
-
Field Details
-
VALUE_NAMES
-
ENTITY_NAMES
-
entity
-
value
-
minimum
-
maximum
-
-
Constructor Details
-
Limit
public Limit()Creates a new instance with the following defaults:- counter entity:
ICoverageNode.CounterEntity.INSTRUCTION
- counter value:
ICounter.CounterValue.COVEREDRATIO
- minimum: no limit
- maximum: no limit
- counter entity:
-
-
Method Details
-
getEntity
- Returns:
- the configured counter entity to check
-
setCounter
Sets the counter entity to check.- Parameters:
entity
- counter entity to check
-
getValue
- Returns:
- the configured value to check
-
setValue
Sets the value to check.- Parameters:
value
- value to check
-
getMinimum
- Returns:
- configured minimum value, or
null
if no minimum is given
-
setMinimum
Sets the expected minimum value. If the minimum refers to a ratio it must be in the range from 0.0 to 1.0 where the number of decimal places will also determine the precision in error messages. A limit ratio may optionally be declared as a percentage where 0.80 and 80% represent the same value.- Parameters:
minimum
- allowed minimum ornull
, if no minimum should be checked
-
getMaximum
- Returns:
- configured maximum value, or
null
if no maximum is given
-
setMaximum
Sets the expected maximum value. If the maximum refers to a ratio it must be in the range from 0.0 to 1.0 where the number of decimal places will also determine the precision in error messages. A limit ratio may optionally be declared as a percentage where 0.80 and 80% represent the same value.- Parameters:
maximum
- allowed maximum ornull
, if no maximum should be checked
-
parseValue
-
check
-
message
-
checkRatioLimit
-
checkRatioLimit
-