Package org.sonar.api.batch.rule

Examples of org.sonar.api.batch.rule.Rule


    assertThat(rules.findAll()).hasSize(3);
    assertThat(rules.findByRepository("squid")).hasSize(2);
    assertThat(rules.findByRepository("findbugs")).hasSize(1);
    assertThat(rules.findByRepository("unknown")).isEmpty();

    Rule squid1 = rules.find(RuleKey.of("squid", "S0001"));
    assertThat(squid1.key().repository()).isEqualTo("squid");
    assertThat(squid1.key().rule()).isEqualTo("S0001");
    assertThat(squid1.name()).isEqualTo("Detect bug");
    assertThat(squid1.description()).isEqualTo("Detect potential bug");
    assertThat(squid1.internalKey()).isEqualTo("foo=bar");
    assertThat(squid1.status()).isEqualTo(RuleStatus.BETA);
    assertThat(squid1.severity()).isEqualTo(Severity.CRITICAL);
    assertThat(squid1.debtSubCharacteristic()).isEqualTo("COMPILER");
    assertThat(squid1.debtRemediationFunction().type()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET);
    assertThat(squid1.debtRemediationFunction().coefficient()).isEqualTo(Duration.create(10));
    assertThat(squid1.debtRemediationFunction().offset()).isEqualTo(Duration.create(60));
    assertThat(squid1.debtSubCharacteristic()).isEqualTo("COMPILER");
    assertThat(squid1.params()).hasSize(2);
    assertThat(squid1.param("min").key()).isEqualTo("min");
    assertThat(squid1.param("min").description()).isNull();
    assertThat(squid1.param("max").key()).isEqualTo("max");
    assertThat(squid1.param("max").description()).isEqualTo("Maximum");

    Rule squid2 = rules.find(RuleKey.of("squid", "S0002"));
    assertThat(squid2.key().repository()).isEqualTo("squid");
    assertThat(squid2.key().rule()).isEqualTo("S0002");
    assertThat(squid2.description()).isNull();
    assertThat(squid2.internalKey()).isNull();
    assertThat(squid2.status()).isEqualTo(RuleStatus.defaultStatus());
    assertThat(squid2.severity()).isEqualTo(Severity.defaultSeverity());
    assertThat(squid2.debtSubCharacteristic()).isNull();
    assertThat(squid2.debtRemediationFunction()).isNull();
    assertThat(squid2.params()).isEmpty();
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.batch.rule.Rule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.