use of org.sonar.server.debt.DebtModelXMLExporter.RuleDebt in project sonarqube by SonarSource.
the class DebtRulesXMLImporterTest method import_linear_having_offset_to_zero.
@Test
public void import_linear_having_offset_to_zero() throws Exception {
String xml = getFileContent("import_linear_having_offset_to_zero.xml");
List<RuleDebt> results = underTest.importXML(xml, validationMessages);
assertThat(results).hasSize(1);
RuleDebt ruleDebt = results.get(0);
assertThat(ruleDebt.ruleKey()).isEqualTo(RuleKey.of("checkstyle", "Regexp"));
assertThat(ruleDebt.function()).isEqualTo(DebtRemediationFunction.Type.LINEAR.name());
assertThat(ruleDebt.coefficient()).isEqualTo("3h");
assertThat(ruleDebt.offset()).isNull();
}
use of org.sonar.server.debt.DebtModelXMLExporter.RuleDebt in project sonarqube by SonarSource.
the class DebtRulesXMLImporterTest method convert_deprecated_linear_with_threshold_function_by_linear_function.
@Test
public void convert_deprecated_linear_with_threshold_function_by_linear_function() throws Exception {
String xml = getFileContent("convert_deprecated_linear_with_threshold_function_by_linear_function.xml");
List<RuleDebt> results = underTest.importXML(xml, validationMessages);
assertThat(results).hasSize(1);
RuleDebt ruleDebt = results.get(0);
assertThat(ruleDebt.function()).isEqualTo(DebtRemediationFunction.Type.LINEAR.name());
assertThat(ruleDebt.coefficient()).isEqualTo("3h");
assertThat(ruleDebt.offset()).isNull();
assertThat(validationMessages.getWarnings()).isNotEmpty();
}
use of org.sonar.server.debt.DebtModelXMLExporter.RuleDebt in project sonarqube by SonarSource.
the class DebtRulesXMLImporterTest method import_linear_with_offset.
@Test
public void import_linear_with_offset() throws Exception {
String xml = getFileContent("import_linear_with_offset.xml");
List<RuleDebt> results = underTest.importXML(xml, validationMessages);
assertThat(results).hasSize(1);
RuleDebt ruleDebt = results.get(0);
assertThat(ruleDebt.function()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET.name());
assertThat(ruleDebt.coefficient()).isEqualTo("3h");
assertThat(ruleDebt.offset()).isEqualTo("1min");
}
use of org.sonar.server.debt.DebtModelXMLExporter.RuleDebt in project sonarqube by SonarSource.
the class DebtRulesXMLImporterTest method use_default_unit_when_no_unit.
@Test
public void use_default_unit_when_no_unit() throws Exception {
String xml = getFileContent("use_default_unit_when_no_unit.xml");
List<RuleDebt> results = underTest.importXML(xml, validationMessages);
assertThat(results).hasSize(1);
RuleDebt ruleDebt = results.get(0);
assertThat(ruleDebt.function()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET.name());
assertThat(ruleDebt.coefficient()).isEqualTo("3d");
assertThat(ruleDebt.offset()).isEqualTo("1d");
}
Aggregations