Search in sources :

Example 1 with InExtendedProjectDuplicate

use of org.sonar.ce.task.projectanalysis.duplication.InExtendedProjectDuplicate in project sonarqube by SonarSource.

the class LoadDuplicationsFromReportStepTest method loads_duplication_with_otherFileRef_as_InExtendedProject_duplication.

@Test
public void loads_duplication_with_otherFileRef_as_InExtendedProject_duplication() {
    Branch branch = mock(Branch.class);
    when(branch.getType()).thenReturn(BranchType.PULL_REQUEST);
    analysisMetadataHolder.setBranch(branch);
    reportReader.putDuplications(FILE_1_REF, createDuplication(singleLineTextRange(LINE), createInProjectDuplicate(FILE_2_REF, LINE + 1)));
    TestComputationStepContext context = new TestComputationStepContext();
    underTest.execute(context);
    assertDuplications(FILE_1_REF, singleLineDetailedTextBlock(1, LINE), new InExtendedProjectDuplicate(treeRootHolder.getComponentByRef(FILE_2_REF), singleLineTextBlock(LINE + 1)));
    assertNoDuplication(FILE_2_REF);
    assertNbOfDuplications(context, 1);
}
Also used : Branch(org.sonar.ce.task.projectanalysis.analysis.Branch) TestComputationStepContext(org.sonar.ce.task.step.TestComputationStepContext) InExtendedProjectDuplicate(org.sonar.ce.task.projectanalysis.duplication.InExtendedProjectDuplicate) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Branch (org.sonar.ce.task.projectanalysis.analysis.Branch)1 InExtendedProjectDuplicate (org.sonar.ce.task.projectanalysis.duplication.InExtendedProjectDuplicate)1 TestComputationStepContext (org.sonar.ce.task.step.TestComputationStepContext)1