aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-26 14:02:47 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-26 14:02:56 +0100
commitd3cc1dae7f60510c75f4ce689d491012e21d6e62 (patch)
treebe486857c40d44a5dffe727eeb1c96dc5bda3f23 /sonar-plugin-api/src
parentbb7cd8ae7cfe14b8ed9e55a4bb954adc91326afb (diff)
downloadsonarqube-d3cc1dae7f60510c75f4ce689d491012e21d6e62.tar.gz
sonarqube-d3cc1dae7f60510c75f4ce689d491012e21d6e62.zip
Replace factor by coefficient
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/DebtRemediationFunction.java26
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rule.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtRemediationFunction.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java10
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunctions.java12
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java13
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java14
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/DefaultDebtRemediationFunctionTest.java6
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/RulesBuilderTest.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/server/debt/DefaultDebtRemediationFunctionTest.java34
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java2
11 files changed, 69 insertions, 60 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/DebtRemediationFunction.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/DebtRemediationFunction.java
index 459f96655de..5ce0a5e2482 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/DebtRemediationFunction.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/DebtRemediationFunction.java
@@ -39,25 +39,25 @@ public class DebtRemediationFunction {
}
private Type type;
- private Duration factor;
+ private Duration coefficient;
private Duration offset;
- private DebtRemediationFunction(Type type, @Nullable Duration factor, @Nullable Duration offset) {
+ private DebtRemediationFunction(Type type, @Nullable Duration coefficient, @Nullable Duration offset) {
this.type = type;
- this.factor = factor;
+ this.coefficient = coefficient;
this.offset = offset;
}
- public static DebtRemediationFunction create(Type type, @Nullable Duration factor, @Nullable Duration offset) {
- return new DebtRemediationFunction(type, factor, offset);
+ public static DebtRemediationFunction create(Type type, @Nullable Duration coefficient, @Nullable Duration offset) {
+ return new DebtRemediationFunction(type, coefficient, offset);
}
- public static DebtRemediationFunction createLinear(Duration factor) {
- return new DebtRemediationFunction(Type.LINEAR, factor, null);
+ public static DebtRemediationFunction createLinear(Duration coefficient) {
+ return new DebtRemediationFunction(Type.LINEAR, coefficient, null);
}
- public static DebtRemediationFunction createLinearWithOffset(Duration factor, Duration offset) {
- return new DebtRemediationFunction(Type.LINEAR_OFFSET, factor, offset);
+ public static DebtRemediationFunction createLinearWithOffset(Duration coefficient, Duration offset) {
+ return new DebtRemediationFunction(Type.LINEAR_OFFSET, coefficient, offset);
}
public static DebtRemediationFunction createConstantPerIssue(Duration offset) {
@@ -69,8 +69,8 @@ public class DebtRemediationFunction {
}
@CheckForNull
- public Duration factor() {
- return factor;
+ public Duration coefficient() {
+ return coefficient;
}
@CheckForNull
@@ -89,7 +89,7 @@ public class DebtRemediationFunction {
DebtRemediationFunction that = (DebtRemediationFunction) o;
return new EqualsBuilder()
.append(type, that.type())
- .append(factor, that.factor())
+ .append(coefficient, that.coefficient())
.append(offset, that.offset())
.isEquals();
}
@@ -98,7 +98,7 @@ public class DebtRemediationFunction {
public int hashCode() {
return new HashCodeBuilder(15, 31)
.append(type)
- .append(factor)
+ .append(coefficient)
.append(offset)
.toHashCode();
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rule.java
index b1aed121df0..f87317dfdab 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rule.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rule.java
@@ -61,7 +61,7 @@ public interface Rule {
String debtCharacteristic();
/**
- * Remediation function : can by Linear (with a factor), Linear with offset (with a factor and an offset) or Constant per issue (with an offset)
+ * Remediation function : can by Linear (with a coefficient), Linear with offset (with a coefficient and an offset) or Constant per issue (with an offset)
*
* @since 4.3
*/
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtRemediationFunction.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtRemediationFunction.java
index 3c8e9971dd2..fdb10ce1a6a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtRemediationFunction.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtRemediationFunction.java
@@ -26,12 +26,12 @@ import javax.annotation.CheckForNull;
* Function used to calculate the remediation cost of an issue. There are three types :
* <ul>
* <li>
- * <b>Linear</b> - Each issue of the rule costs the same amount of time (factor) to fix.
+ * <b>Linear</b> - Each issue of the rule costs the same amount of time (coefficient) to fix.
* </li>
* <li>
* <b>Linear with offset</b> - It takes a certain amount of time to analyze the issues of such kind on the file (offset).
- * Then, each issue of the rule costs the same amount of time (factor) to fix. Total remediation cost
- * by file = offset + (number of issues x factor)
+ * Then, each issue of the rule costs the same amount of time (coefficient) to fix. Total remediation cost
+ * by file = offset + (number of issues x coefficient)
* </li>
* <li><b>Constant/issue</b> - The cost to fix all the issues of the rule is the same whatever the number of issues
* of this rule in the file. Total remediation cost by file = constant
@@ -52,7 +52,7 @@ public interface DebtRemediationFunction {
* Factor is set on types {@link Type#LINEAR} and {@link Type#LINEAR_OFFSET}, else it's null.
*/
@CheckForNull
- String factor();
+ String coefficient();
/**
* Offset is set on types {@link Type#LINEAR_OFFSET} and {@link Type#CONSTANT_ISSUE}, else it's null.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java
index 1f13976ea27..68372f99eba 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtRemediationFunction.java
@@ -38,7 +38,7 @@ public class DefaultDebtRemediationFunction implements DebtRemediationFunction {
public DefaultDebtRemediationFunction(Type type, @Nullable String factor, @Nullable String offset) {
this.type = type;
- this.factor = sanitizeValue("factor", factor);
+ this.factor = sanitizeValue("coefficient", factor);
this.offset = sanitizeValue("offset", offset);
validate();
}
@@ -63,7 +63,7 @@ public class DefaultDebtRemediationFunction implements DebtRemediationFunction {
@Override
@CheckForNull
- public String factor() {
+ public String coefficient() {
return factor;
}
@@ -77,12 +77,12 @@ public class DefaultDebtRemediationFunction implements DebtRemediationFunction {
switch (type) {
case LINEAR:
if (this.factor == null || this.offset != null) {
- throw new IllegalArgumentException(String.format("Only factor must be set on %s", this));
+ throw new IllegalArgumentException(String.format("Only coefficient must be set on %s", this));
}
break;
case LINEAR_OFFSET:
if (this.factor == null || this.offset == null) {
- throw new IllegalArgumentException(String.format("Both factor and offset are required on %s", this));
+ throw new IllegalArgumentException(String.format("Both coefficient and offset are required on %s", this));
}
break;
case CONSTANT_ISSUE:
@@ -125,7 +125,7 @@ public class DefaultDebtRemediationFunction implements DebtRemediationFunction {
public String toString() {
return Objects.toStringHelper(DebtRemediationFunction.class)
.add("type", type)
- .add("factor", factor)
+ .add("coefficient", factor)
.add("offset", offset)
.toString();
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunctions.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunctions.java
index a2fa542e6dd..0b97f49695e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunctions.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/DefaultDebtRemediationFunctions.java
@@ -41,13 +41,13 @@ class DefaultDebtRemediationFunctions implements RulesDefinition.DebtRemediation
}
@Override
- public DebtRemediationFunction linear(String factor) {
- return create(DefaultDebtRemediationFunction.Type.LINEAR, factor, null);
+ public DebtRemediationFunction linear(String coefficient) {
+ return create(DefaultDebtRemediationFunction.Type.LINEAR, coefficient, null);
}
@Override
- public DebtRemediationFunction linearWithOffset(String factor, String offset) {
- return create(DefaultDebtRemediationFunction.Type.LINEAR_OFFSET, factor, offset);
+ public DebtRemediationFunction linearWithOffset(String coefficient, String offset) {
+ return create(DefaultDebtRemediationFunction.Type.LINEAR_OFFSET, coefficient, offset);
}
@Override
@@ -55,9 +55,9 @@ class DefaultDebtRemediationFunctions implements RulesDefinition.DebtRemediation
return create(DefaultDebtRemediationFunction.Type.CONSTANT_ISSUE, null, offset);
}
- private DebtRemediationFunction create(DefaultDebtRemediationFunction.Type type, @Nullable String factor, @Nullable String offset) {
+ private DebtRemediationFunction create(DefaultDebtRemediationFunction.Type type, @Nullable String coefficient, @Nullable String offset) {
try {
- return new DefaultDebtRemediationFunction(type, factor, offset);
+ return new DefaultDebtRemediationFunction(type, coefficient, offset);
} catch (Exception e) {
throw MessageException.of(String.format("The rule '%s:%s' is invalid : %s ", this.repoKey, this.key, e.getMessage()));
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
index 7c01f5836c7..4adcdfac2d1 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
@@ -20,13 +20,7 @@
package org.sonar.api.server.rule;
import com.google.common.base.Strings;
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSortedSet;
-import com.google.common.collect.ListMultimap;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
+import com.google.common.collect.*;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.LoggerFactory;
@@ -38,6 +32,7 @@ import org.sonar.api.server.debt.DebtRemediationFunction;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
+
import java.io.IOException;
import java.net.URL;
import java.util.Collection;
@@ -509,9 +504,9 @@ public interface RulesDefinition extends ServerExtension {
* Factory of {@link org.sonar.api.server.debt.DebtRemediationFunction}.
*/
interface DebtRemediationFunctions {
- DebtRemediationFunction linear(String factor);
+ DebtRemediationFunction linear(String coefficient);
- DebtRemediationFunction linearWithOffset(String factor, String offset);
+ DebtRemediationFunction linearWithOffset(String coefficient, String offset);
DebtRemediationFunction constantPerIssue(String offset);
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java
index 31ea02837d2..e933c99a99e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java
@@ -51,10 +51,16 @@ public class Duration implements Serializable {
this(((long) days * hoursInDay * MINUTES_IN_ONE_HOUR) + (hours * MINUTES_IN_ONE_HOUR) + minutes);
}
+ /**
+ *
+ */
public static Duration create(long durationInMinutes) {
return new Duration(durationInMinutes);
}
+ /**
+ *
+ */
public static Duration decode(String text, int hoursInDay) {
int days = 0, hours = 0, minutes = 0;
String sanitizedText = StringUtils.deleteWhitespace(text);
@@ -88,6 +94,9 @@ public class Duration implements Serializable {
}
}
+ /**
+ *
+ */
public String encode(int hoursInDay) {
int days = ((Double) ((double) durationInMinutes / hoursInDay / MINUTES_IN_ONE_HOUR)).intValue();
Long remainingDuration = durationInMinutes - (days * hoursInDay * MINUTES_IN_ONE_HOUR);
@@ -111,6 +120,11 @@ public class Duration implements Serializable {
return stringBuilder.toString();
}
+ /**
+ * Return the duration in minutes.
+ * <br>
+ * For instance, Duration.decode(1h, 24) will return 60.
+ */
public long toMinutes() {
return durationInMinutes;
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/DefaultDebtRemediationFunctionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/DefaultDebtRemediationFunctionTest.java
index d63bfea969f..4bcb659a5b2 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/DefaultDebtRemediationFunctionTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/DefaultDebtRemediationFunctionTest.java
@@ -31,7 +31,7 @@ public class DefaultDebtRemediationFunctionTest {
public void create_linear() throws Exception {
DebtRemediationFunction function = DebtRemediationFunction.createLinear(Duration.create(10));
assertThat(function.type()).isEqualTo(DebtRemediationFunction.Type.LINEAR);
- assertThat(function.factor()).isEqualTo(Duration.create(10));
+ assertThat(function.coefficient()).isEqualTo(Duration.create(10));
assertThat(function.offset()).isNull();
}
@@ -39,7 +39,7 @@ public class DefaultDebtRemediationFunctionTest {
public void create_linear_with_offset() throws Exception {
DebtRemediationFunction function = DebtRemediationFunction.createLinearWithOffset(Duration.create(10), Duration.create(5));
assertThat(function.type()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET);
- assertThat(function.factor()).isEqualTo(Duration.create(10));
+ assertThat(function.coefficient()).isEqualTo(Duration.create(10));
assertThat(function.offset()).isEqualTo(Duration.create(5));
}
@@ -47,7 +47,7 @@ public class DefaultDebtRemediationFunctionTest {
public void create_constant_per_issue() throws Exception {
DebtRemediationFunction function = DebtRemediationFunction.createConstantPerIssue(Duration.create(10));
assertThat(function.type()).isEqualTo(DebtRemediationFunction.Type.CONSTANT_ISSUE);
- assertThat(function.factor()).isNull();
+ assertThat(function.coefficient()).isNull();
assertThat(function.offset()).isEqualTo(Duration.create(10));
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/RulesBuilderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/RulesBuilderTest.java
index 881823e3cf6..e569d4e1db1 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/RulesBuilderTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/RulesBuilderTest.java
@@ -73,7 +73,7 @@ public class RulesBuilderTest {
assertThat(squid1.severity()).isEqualTo(Severity.CRITICAL);
assertThat(squid1.debtCharacteristic()).isEqualTo("COMPILER");
assertThat(squid1.debtRemediationFunction().type()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET);
- assertThat(squid1.debtRemediationFunction().factor()).isEqualTo(Duration.create(10));
+ assertThat(squid1.debtRemediationFunction().coefficient()).isEqualTo(Duration.create(10));
assertThat(squid1.debtRemediationFunction().offset()).isEqualTo(Duration.create(60));
assertThat(squid1.debtCharacteristic()).isEqualTo("COMPILER");
assertThat(squid1.params()).hasSize(2);
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/debt/DefaultDebtRemediationFunctionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/debt/DefaultDebtRemediationFunctionTest.java
index f4c28fe2737..8bdefe18651 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/server/debt/DefaultDebtRemediationFunctionTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/debt/DefaultDebtRemediationFunctionTest.java
@@ -32,7 +32,7 @@ public class DefaultDebtRemediationFunctionTest {
public void create_linear() {
DebtRemediationFunction function = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR, "10h", null);
assertThat(function.type()).isEqualTo(DefaultDebtRemediationFunction.Type.LINEAR);
- assertThat(function.factor()).isEqualTo("10h");
+ assertThat(function.coefficient()).isEqualTo("10h");
assertThat(function.offset()).isNull();
}
@@ -40,7 +40,7 @@ public class DefaultDebtRemediationFunctionTest {
public void create_linear_with_offset() {
DebtRemediationFunction function = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "10h", "5min");
assertThat(function.type()).isEqualTo(DefaultDebtRemediationFunction.Type.LINEAR_OFFSET);
- assertThat(function.factor()).isEqualTo("10h");
+ assertThat(function.coefficient()).isEqualTo("10h");
assertThat(function.offset()).isEqualTo("5min");
}
@@ -48,25 +48,25 @@ public class DefaultDebtRemediationFunctionTest {
public void create_constant_per_issue() {
DebtRemediationFunction function = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE, null, "10h");
assertThat(function.type()).isEqualTo(DefaultDebtRemediationFunction.Type.CONSTANT_ISSUE);
- assertThat(function.factor()).isNull();
+ assertThat(function.coefficient()).isNull();
assertThat(function.offset()).isEqualTo("10h");
}
@Test
- public void sanitize_remediation_factor_and_offset() {
+ public void sanitize_remediation_coefficient_and_offset() {
DebtRemediationFunction function = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, " 1 h ", " 10 min");
- assertThat(function.factor()).isEqualTo("1h");
+ assertThat(function.coefficient()).isEqualTo("1h");
assertThat(function.offset()).isEqualTo("10min");
}
@Test
- public void fail_to_create_linear_when_no_factor() {
+ public void fail_to_create_linear_when_no_coefficient() {
try {
new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR, null, "10h");
fail();
} catch (IllegalArgumentException e) {
- assertThat(e).hasMessage("Only factor must be set on DebtRemediationFunction{type=LINEAR, factor=null, offset=10h}");
+ assertThat(e).hasMessage("Only coefficient must be set on DebtRemediationFunction{type=LINEAR, coefficient=null, offset=10h}");
}
}
@@ -76,7 +76,7 @@ public class DefaultDebtRemediationFunctionTest {
new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR, "5min", "10h");
fail();
} catch (IllegalArgumentException e) {
- assertThat(e).hasMessage("Only factor must be set on DebtRemediationFunction{type=LINEAR, factor=5min, offset=10h}");
+ assertThat(e).hasMessage("Only coefficient must be set on DebtRemediationFunction{type=LINEAR, coefficient=5min, offset=10h}");
}
}
@@ -86,27 +86,27 @@ public class DefaultDebtRemediationFunctionTest {
new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE, "10h", null);
fail();
} catch (IllegalArgumentException e) {
- assertThat(e).hasMessage("Only offset must be set on DebtRemediationFunction{type=CONSTANT_ISSUE, factor=10h, offset=null}");
+ assertThat(e).hasMessage("Only offset must be set on DebtRemediationFunction{type=CONSTANT_ISSUE, coefficient=10h, offset=null}");
}
}
@Test
- public void fail_to_create_constant_per_issue_when_factor() {
+ public void fail_to_create_constant_per_issue_when_coefficient() {
try {
new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE, "5min", "10h");
fail();
} catch (IllegalArgumentException e) {
- assertThat(e).hasMessage("Only offset must be set on DebtRemediationFunction{type=CONSTANT_ISSUE, factor=5min, offset=10h}");
+ assertThat(e).hasMessage("Only offset must be set on DebtRemediationFunction{type=CONSTANT_ISSUE, coefficient=5min, offset=10h}");
}
}
@Test
- public void fail_to_create_linear_with_offset_when_no_factor() {
+ public void fail_to_create_linear_with_offset_when_no_coefficient() {
try {
new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "", "10h");
fail();
} catch (IllegalArgumentException e) {
- assertThat(e).hasMessage("Both factor and offset are required on DebtRemediationFunction{type=LINEAR_OFFSET, factor=null, offset=10h}");
+ assertThat(e).hasMessage("Both coefficient and offset are required on DebtRemediationFunction{type=LINEAR_OFFSET, coefficient=null, offset=10h}");
}
}
@@ -116,7 +116,7 @@ public class DefaultDebtRemediationFunctionTest {
new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "5min", "");
fail();
} catch (IllegalArgumentException e) {
- assertThat(e).hasMessage("Both factor and offset are required on DebtRemediationFunction{type=LINEAR_OFFSET, factor=5min, offset=null}");
+ assertThat(e).hasMessage("Both coefficient and offset are required on DebtRemediationFunction{type=LINEAR_OFFSET, coefficient=5min, offset=null}");
}
}
@@ -143,16 +143,16 @@ public class DefaultDebtRemediationFunctionTest {
@Test
public void test_to_string() {
assertThat(new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "10h", "5min").toString())
- .isEqualTo("DebtRemediationFunction{type=LINEAR_OFFSET, factor=10h, offset=5min}");
+ .isEqualTo("DebtRemediationFunction{type=LINEAR_OFFSET, coefficient=10h, offset=5min}");
}
@Test
- public void fail_if_bad_factor_format() {
+ public void fail_if_bad_coefficient_format() {
try {
new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR, "foo", null);
fail();
} catch (IllegalArgumentException e) {
- assertThat(e).hasMessage("Invalid factor: foo");
+ assertThat(e).hasMessage("Invalid coefficient: foo");
}
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java
index 186fe99dc22..3a028382d3c 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java
@@ -95,7 +95,7 @@ public class RulesDefinitionTest {
assertThat(rule.status()).isEqualTo(RuleStatus.BETA);
assertThat(rule.debtSubCharacteristic()).isEqualTo("COMPILER");
assertThat(rule.debtRemediationFunction().type()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET);
- assertThat(rule.debtRemediationFunction().factor()).isEqualTo("1h");
+ assertThat(rule.debtRemediationFunction().coefficient()).isEqualTo("1h");
assertThat(rule.debtRemediationFunction().offset()).isEqualTo("10min");
assertThat(rule.effortToFixDescription()).isEqualTo("squid.S115.effortToFix");
assertThat(rule.toString()).isEqualTo("[repository=findbugs, key=NPE]");