assertThat(rule.getName()).isEqualTo("bar");
assertThat(rule.getDescription()).isEqualTo("Foo Bar");
assertThat(rule.getSeverity()).isEqualTo(RulePriority.BLOCKER);
- assertThat(rule.getStatus()).isEqualTo("READY");
+ assertThat(rule.getStatus()).isEqualTo(org.sonar.check.Rule.STATUS_READY);
assertThat(rule.getParams()).hasSize(1);
RuleParam prop = rule.getParam("property");
static class RuleWithoutNameNorDescription {
}
- @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", status = "READY", priority = Priority.BLOCKER)
+ @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", status = org.sonar.check.Rule.STATUS_READY, priority = Priority.BLOCKER)
static class RuleWithProperty {
@org.sonar.check.RuleProperty(description = "Ignore ?", defaultValue = "false")
private String property;
private String additionalProperty;
}
- @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", status = "READY", priority = Priority.BLOCKER)
+ @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", status = org.sonar.check.Rule.STATUS_READY, priority = Priority.BLOCKER)
static class RuleWithIntegerProperty {
@org.sonar.check.RuleProperty(description = "Max", defaultValue = "12")
private Integer property;
}
- @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", status = "READY", priority = Priority.BLOCKER)
+ @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", status = org.sonar.check.Rule.STATUS_READY, priority = Priority.BLOCKER)
static class RuleWithTextProperty {
@org.sonar.check.RuleProperty(description = "text", defaultValue = "Long text", type = "TEXT")
protected String property;
}
- @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", status = "READY", priority = Priority.BLOCKER)
+ @org.sonar.check.Rule(key = "foo", name = "bar", description = "Foo Bar", status = org.sonar.check.Rule.STATUS_READY, priority = Priority.BLOCKER)
static class RuleWithInvalidPropertyType {
@org.sonar.check.RuleProperty(description = "text", defaultValue = "Long text", type = "INVALID")
public String property;
public class RuleTest {
@Test
- public void descriptionShouldBeCleaned() {
+ public void description_should_be_cleaned() {
Rule rule = new Rule();
rule.setDescription(" my description ");
Assert.assertEquals("my description", rule.getDescription());
}
@Test
- public void shouldRemoveNewLineCharactersInNameWithSetter() {
+ public void should_remove_new_line_characters_in_name_with_setter() {
Rule rule = new Rule();
for (String example : getExamplesContainingNewLineCharacter()) {
rule.setName(example);
}
@Test
- public void shouldRemoveNewLineCharactersInNameWithfirstConstructor() {
+ public void should_remove_new_line_characters_in_name_with_first_constructor() {
Rule rule;
for (String example : getExamplesContainingNewLineCharacter()) {
rule = new Rule(null, null).setName(example);
}
@Test
- public void shouldRemoveNewLineCharactersInNameWithSecondConstructor() {
+ public void should_remove_new_line_characters_in_name_with_second_constructor() {
Rule rule;
for (String example : getExamplesContainingNewLineCharacter()) {
rule = new Rule(null, null).setName(example);
}
@Test
- public void defaultPriorityIsMajor() {
+ public void default_priority_is_major() {
Rule rule = new Rule();
assertThat(rule.getSeverity(), Is.is(RulePriority.MAJOR));