Package org.sonar.api.batch.debt

Examples of org.sonar.api.batch.debt.DebtCharacteristic


  private DebtCharacteristic effectiveCharacteristic(RuleDto ruleDto, RuleKey ruleKey, DefaultDebtModel debtModel) {
    Integer subCharacteristicId = ruleDto.getSubCharacteristicId();
    Integer defaultSubCharacteristicId = ruleDto.getDefaultSubCharacteristicId();
    Integer effectiveSubCharacteristicId = subCharacteristicId != null ? subCharacteristicId : defaultSubCharacteristicId;
    DebtCharacteristic subCharacteristic = debtModel.characteristicById(effectiveSubCharacteristicId);
    if (subCharacteristic == null) {
      throw new IllegalStateException(String.format("Sub characteristic id '%s' on rule '%s' has not been found", effectiveSubCharacteristicId, ruleKey));
    }
    return subCharacteristic;
  }
View Full Code Here


    when(dao.selectEnabledCharacteristics()).thenReturn(newArrayList(rootCharacteristicDto, characteristicDto));

    DebtModel result = provider.provide(dao);
    assertThat(result.characteristics()).hasSize(1);

    DebtCharacteristic characteristic = result.characteristicByKey("MEMORY_EFFICIENCY");
    assertThat(characteristic.key()).isEqualTo("MEMORY_EFFICIENCY");
    assertThat(characteristic.name()).isEqualTo("Memory use");
    assertThat(characteristic.isSub()).isFalse();
    assertThat(characteristic.order()).isEqualTo(1);

    DebtCharacteristic subCharacteristic = result.characteristicByKey("EFFICIENCY");
    assertThat(subCharacteristic.key()).isEqualTo("EFFICIENCY");
    assertThat(subCharacteristic.name()).isEqualTo("Efficiency");
    assertThat(subCharacteristic.isSub()).isTrue();
    assertThat(subCharacteristic.order()).isNull();
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.batch.debt.DebtCharacteristic

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.