summaryrefslogtreecommitdiffstats
path: root/sonar-batch/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-27 14:51:50 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-27 14:51:50 +0100
commit90792a4f54d37f00a4625f946777c3c66f9b8aeb (patch)
tree3f88fab9c5aa2cdc916a4b2002b413d8cff91a20 /sonar-batch/src
parent8b13fc2f6008a413be975d7b59cefdaa45ce0fd7 (diff)
downloadsonarqube-90792a4f54d37f00a4625f946777c3c66f9b8aeb.tar.gz
sonarqube-90792a4f54d37f00a4625f946777c3c66f9b8aeb.zip
Rename RuleDto characteristic to subCharacteristic
Diffstat (limited to 'sonar-batch/src')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java14
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java2
2 files changed, 8 insertions, 8 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java b/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java
index b4ec1b061ff..821cdbe4b3d 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/rule/RulesProvider.java
@@ -93,14 +93,14 @@ public class RulesProvider extends ProviderAdapter {
}
private Characteristic effectiveCharacteristic(RuleDto ruleDto, RuleKey ruleKey, TechnicalDebtModel debtModel) {
- Integer characteristicId = ruleDto.getCharacteristicId();
- Integer defaultCharacteristicId = ruleDto.getDefaultCharacteristicId();
- Integer effectiveCharacteristicId = characteristicId != null ? characteristicId : defaultCharacteristicId;
- Characteristic characteristic = debtModel.characteristicById(effectiveCharacteristicId);
- if (characteristic == null) {
- throw new IllegalStateException(String.format("Characteristic id '%s' on rule '%s' has not been found", effectiveCharacteristicId, ruleKey));
+ Integer subCharacteristicId = ruleDto.getSubCharacteristicId();
+ Integer defaultSubCharacteristicId = ruleDto.getDefaultSubCharacteristicId();
+ Integer effectiveSubCharacteristicId = subCharacteristicId != null ? subCharacteristicId : defaultSubCharacteristicId;
+ Characteristic subCharacteristic = debtModel.characteristicById(effectiveSubCharacteristicId);
+ if (subCharacteristic == null) {
+ throw new IllegalStateException(String.format("Sub characteristic id '%s' on rule '%s' has not been found", effectiveSubCharacteristicId, ruleKey));
}
- return characteristic;
+ return subCharacteristic;
}
private DebtRemediationFunction effectiveFunction(RuleDto ruleDto, RuleKey ruleKey, Durations durations) {
diff --git a/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java
index 08106710bfe..ffcab662476 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/rule/RulesProviderTest.java
@@ -192,7 +192,7 @@ public class RulesProviderTest extends AbstractDaoTestCase {
provider.provide(ruleDao, debtModel, durations);
fail();
} catch (Exception e) {
- assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Characteristic id '999' on rule 'checkstyle:AvoidNull' has not been found");
+ assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("Sub characteristic id '999' on rule 'checkstyle:AvoidNull' has not been found");
}
}