use of org.sonar.api.batch.sensor.rule.NewAdHocRule in project sonarqube by SonarSource.
the class DefaultAdHocRuleTest method fail_to_store_if_no_name.
@Test
public void fail_to_store_if_no_name() {
SensorStorage storage = mock(SensorStorage.class);
NewAdHocRule rule = new DefaultAdHocRule(storage).engineId("engine").ruleId("ruleId").name(" ").description("desc").severity(Severity.BLOCKER).type(RuleType.CODE_SMELL);
assertThatThrownBy(() -> rule.save()).isInstanceOf(IllegalStateException.class).hasMessageContaining("Name is mandatory");
}
use of org.sonar.api.batch.sensor.rule.NewAdHocRule in project sonarqube by SonarSource.
the class DefaultAdHocRuleTest method fail_to_store_if_no_engine_id.
@Test
public void fail_to_store_if_no_engine_id() {
SensorStorage storage = mock(SensorStorage.class);
NewAdHocRule rule = new DefaultAdHocRule(storage).engineId(" ").ruleId("ruleId").name("name").description("desc").severity(Severity.BLOCKER).type(RuleType.CODE_SMELL);
assertThatThrownBy(() -> rule.save()).isInstanceOf(IllegalStateException.class).hasMessageContaining("Engine id is mandatory");
}
use of org.sonar.api.batch.sensor.rule.NewAdHocRule in project sonarqube by SonarSource.
the class DefaultAdHocRuleTest method fail_to_store_if_no_rule_id.
@Test
public void fail_to_store_if_no_rule_id() {
SensorStorage storage = mock(SensorStorage.class);
NewAdHocRule rule = new DefaultAdHocRule(storage).engineId("engine").ruleId(" ").name("name").description("desc").severity(Severity.BLOCKER).type(RuleType.CODE_SMELL);
assertThatThrownBy(() -> rule.save()).isInstanceOf(IllegalStateException.class).hasMessageContaining("Rule id is mandatory");
}
use of org.sonar.api.batch.sensor.rule.NewAdHocRule in project sonarqube by SonarSource.
the class DefaultAdHocRuleTest method fail_to_store_if_no_type.
@Test
public void fail_to_store_if_no_type() {
SensorStorage storage = mock(SensorStorage.class);
NewAdHocRule rule = new DefaultAdHocRule(storage).engineId("engine").ruleId("ruleId").name("name").description("desc").severity(Severity.BLOCKER);
assertThatThrownBy(() -> rule.save()).isInstanceOf(IllegalStateException.class).hasMessageContaining("Type is mandatory");
}
use of org.sonar.api.batch.sensor.rule.NewAdHocRule in project sonarqube by SonarSource.
the class DefaultAdHocRuleTest method fail_to_store_if_no_severity.
@Test
public void fail_to_store_if_no_severity() {
SensorStorage storage = mock(SensorStorage.class);
NewAdHocRule rule = new DefaultAdHocRule(storage).engineId("engine").ruleId("ruleId").name("name").description("desc").type(RuleType.CODE_SMELL);
assertThatThrownBy(() -> rule.save()).isInstanceOf(IllegalStateException.class).hasMessageContaining("Severity is mandatory");
}
Aggregations