use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class NewSizeMeasuresStepTest method compute_duplicated_lines_counts_lines_from_original_and_InnerDuplicate_only_once.
@Test
public void compute_duplicated_lines_counts_lines_from_original_and_InnerDuplicate_only_once() {
TextBlock original = new TextBlock(1, 10);
duplicationRepository.addDuplication(FILE_1_REF, original, new TextBlock(10, 11), new TextBlock(11, 12));
duplicationRepository.addDuplication(FILE_1_REF, new TextBlock(2, 2), new TextBlock(4, 4));
setNewLines(FILE_1);
underTest.execute(new TestComputationStepContext());
assertRawMeasureValueOnPeriod(FILE_1_REF, NEW_DUPLICATED_LINES_KEY, 11d);
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class NewSizeMeasuresStepTest method compute_new_lines.
@Test
public void compute_new_lines() {
setNewLines(FILE_1, FILE_2, FILE_4);
underTest.execute(new TestComputationStepContext());
assertRawMeasureValueOnPeriod(FILE_1_REF, NEW_LINES_KEY, 11);
assertRawMeasureValueOnPeriod(FILE_2_REF, NEW_LINES_KEY, 11);
assertNoRawMeasure(FILE_3_REF, NEW_LINES_KEY);
assertRawMeasureValueOnPeriod(FILE_4_REF, NEW_LINES_KEY, 11);
assertRawMeasureValueOnPeriod(DIRECTORY_REF, NEW_LINES_KEY, 22);
assertNoRawMeasure(DIRECTORY_2_REF, NEW_LINES_KEY);
assertRawMeasureValueOnPeriod(ROOT_REF, NEW_LINES_KEY, 33);
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class NewSizeMeasuresStepTest method compute_duplicated_blocks_one_for_original_one_for_each_InnerDuplicate.
@Test
public void compute_duplicated_blocks_one_for_original_one_for_each_InnerDuplicate() {
TextBlock original = new TextBlock(1, 1);
duplicationRepository.addDuplication(FILE_1_REF, original, new TextBlock(2, 2), new TextBlock(4, 4), new TextBlock(3, 4));
setNewLines(FILE_1);
underTest.execute(new TestComputationStepContext());
assertRawMeasureValueOnPeriod(FILE_1_REF, NEW_BLOCKS_DUPLICATED_KEY, 4);
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class NewSizeMeasuresStepTest method compute_and_aggregate_duplicated_lines.
@Test
public void compute_and_aggregate_duplicated_lines() {
addDuplicatedBlock(FILE_1_REF, 2);
addDuplicatedBlock(FILE_3_REF, 10);
addDuplicatedBlock(FILE_4_REF, 12);
setNewLines(FILE_1, FILE_2, FILE_3, FILE_4);
underTest.execute(new TestComputationStepContext());
assertRawMeasureValueOnPeriod(FILE_1_REF, NEW_DUPLICATED_LINES_KEY, 2d);
assertRawMeasureValueOnPeriod(FILE_2_REF, NEW_DUPLICATED_LINES_KEY, 0d);
assertRawMeasureValueOnPeriod(FILE_3_REF, NEW_DUPLICATED_LINES_KEY, 9d);
assertRawMeasureValueOnPeriod(FILE_4_REF, NEW_DUPLICATED_LINES_KEY, 11d);
assertRawMeasureValueOnPeriod(DIRECTORY_REF, NEW_DUPLICATED_LINES_KEY, 2d);
assertNoRawMeasure(DIRECTORY_2_REF, NEW_DUPLICATED_LINES_KEY);
assertRawMeasureValueOnPeriod(ROOT_REF, NEW_DUPLICATED_LINES_KEY, 22d);
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class NewSizeMeasuresStepTest method compute_and_aggregate_duplicated_blocks_from_single_duplication.
@Test
public void compute_and_aggregate_duplicated_blocks_from_single_duplication() {
addDuplicatedBlock(FILE_1_REF, 11);
addDuplicatedBlock(FILE_2_REF, 2);
addDuplicatedBlock(FILE_4_REF, 7);
setNewLines(FILE_1, FILE_2, FILE_3, FILE_4);
underTest.execute(new TestComputationStepContext());
assertRawMeasureValueOnPeriod(FILE_1_REF, NEW_BLOCKS_DUPLICATED_KEY, 10);
assertRawMeasureValueOnPeriod(FILE_2_REF, NEW_BLOCKS_DUPLICATED_KEY, 2);
assertRawMeasureValueOnPeriod(FILE_3_REF, NEW_BLOCKS_DUPLICATED_KEY, 0);
assertRawMeasureValueOnPeriod(FILE_4_REF, NEW_BLOCKS_DUPLICATED_KEY, 6);
assertRawMeasureValueOnPeriod(DIRECTORY_REF, NEW_BLOCKS_DUPLICATED_KEY, 12);
assertRawMeasureValueOnPeriod(ROOT_REF, NEW_BLOCKS_DUPLICATED_KEY, 18);
}
Aggregations