Package org.sonar.api.server.debt.internal

Examples of org.sonar.api.server.debt.internal.DefaultDebtRemediationFunction.coefficient()


  @Test
  public void sanitize_remediation_coefficient_and_offset() {
    DebtRemediationFunction function = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "  1  h   ", "  10   min");

    assertThat(function.coefficient()).isEqualTo("1h");
    assertThat(function.offset()).isEqualTo("10min");
  }

  @Test
  public void fail_to_when_no_type() {
View Full Code Here


  @Test
  public void create_linear() {
    DebtRemediationFunction function = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR, "10h", null);
    assertThat(function.type()).isEqualTo(DefaultDebtRemediationFunction.Type.LINEAR);
    assertThat(function.coefficient()).isEqualTo("10h");
    assertThat(function.offset()).isNull();
  }

  @Test
  public void create_linear_with_offset() {
View Full Code Here

  @Test
  public void create_linear_with_offset() {
    DebtRemediationFunction function = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET, "10h", "5min");
    assertThat(function.type()).isEqualTo(DefaultDebtRemediationFunction.Type.LINEAR_OFFSET);
    assertThat(function.coefficient()).isEqualTo("10h");
    assertThat(function.offset()).isEqualTo("5min");
  }

  @Test
  public void create_constant_per_issue() {
View Full Code Here

  @Test
  public void create_constant_per_issue() {
    DebtRemediationFunction function = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE, null, "10h");
    assertThat(function.type()).isEqualTo(DefaultDebtRemediationFunction.Type.CONSTANT_ISSUE);
    assertThat(function.coefficient()).isNull();
    assertThat(function.offset()).isEqualTo("10h");
  }

  @Test
  public void sanitize_remediation_coefficient_and_offset() {
View Full Code Here

      } else if (!isRuleDebtSameAsOverriddenValues(ruleDto, newSubCharacteristic, newFunction, newCoefficient, newOffset)) {
        ruleDto.setSubCharacteristicId(newSubCharacteristic.getId());

        DefaultDebtRemediationFunction debtRemediationFunction = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.valueOf(newFunction), newCoefficient, newOffset);
        ruleDto.setRemediationFunction(debtRemediationFunction.type().name());
        ruleDto.setRemediationCoefficient(debtRemediationFunction.coefficient());
        ruleDto.setRemediationOffset(debtRemediationFunction.offset());
        needUpdate = true;
      }

      // No sub-characteristic is given -> disable rule debt if not already disabled
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.