Search in sources :

Example 11 with ValidationMessages

use of org.sonar.api.utils.ValidationMessages in project sonarqube by SonarSource.

the class XMLProfileParserTest method importProfileWithRuleParameters.

@Test
public void importProfileWithRuleParameters() {
    ValidationMessages validation = ValidationMessages.create();
    RulesProfile profile = parse("importProfileWithRuleParameters.xml", validation);
    assertThat(validation.hasErrors()).isFalse();
    assertThat(validation.hasWarnings()).isFalse();
    ActiveRule rule = profile.getActiveRule("checkstyle", "IllegalRegexp");
    assertThat(rule.getParameter("format")).isEqualTo("foo");
    assertThat(rule.getParameter("message")).isEqualTo("with special characters < > &");
}
Also used : ActiveRule(org.sonar.api.rules.ActiveRule) ValidationMessages(org.sonar.api.utils.ValidationMessages) Test(org.junit.Test)

Example 12 with ValidationMessages

use of org.sonar.api.utils.ValidationMessages in project sonarqube by SonarSource.

the class XMLProfileParserTest method nameAndLanguageShouldBeMandatory.

@Test
public void nameAndLanguageShouldBeMandatory() {
    ValidationMessages validation = ValidationMessages.create();
    parse("nameAndLanguageShouldBeMandatory.xml", validation);
    assertThat(validation.getErrors()).hasSize(2);
    assertThat(validation.getErrors().get(0)).contains("");
}
Also used : ValidationMessages(org.sonar.api.utils.ValidationMessages) Test(org.junit.Test)

Aggregations

ValidationMessages (org.sonar.api.utils.ValidationMessages)12 Test (org.junit.Test)7 RulesProfile (org.sonar.api.profiles.RulesProfile)5 Reader (java.io.Reader)2 Matchers.anyString (org.mockito.Matchers.anyString)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 ProfileDefinition (org.sonar.api.profiles.ProfileDefinition)2 ProfileImporter (org.sonar.api.profiles.ProfileImporter)2 ActiveRule (org.sonar.api.rules.ActiveRule)2 Rule (org.sonar.api.rules.Rule)2 RuleFinder (org.sonar.api.rules.RuleFinder)2 RuleDebt (org.sonar.server.debt.DebtModelXMLExporter.RuleDebt)1