use of org.sonar.ce.task.projectanalysis.measure.PostMeasuresComputationCheck.Context in project sonarqube by SonarSource.
the class PostMeasuresComputationChecksStepTest method context_contains_ncloc_when_available.
@Test
public void context_contains_ncloc_when_available() {
PostMeasuresComputationCheck check = mock(PostMeasuresComputationCheck.class);
measureRepository.addRawMeasure(DUMB_PROJECT.getReportAttributes().getRef(), CoreMetrics.NCLOC_KEY, Measure.newMeasureBuilder().create(10));
newStep(check).execute(new TestComputationStepContext());
ArgumentCaptor<Context> contextArgumentCaptor = ArgumentCaptor.forClass(Context.class);
verify(check).onCheck(contextArgumentCaptor.capture());
assertThat(contextArgumentCaptor.getValue().getNcloc()).isEqualTo(10);
}
use of org.sonar.ce.task.projectanalysis.measure.PostMeasuresComputationCheck.Context in project sonarqube by SonarSource.
the class PostMeasuresComputationChecksStepTest method context_contains_project_uuid_from_analysis_metada_holder.
@Test
public void context_contains_project_uuid_from_analysis_metada_holder() {
Project project = Project.from(newPrivateProjectDto());
analysisMetadataHolder.setProject(project);
PostMeasuresComputationCheck check = mock(PostMeasuresComputationCheck.class);
newStep(check).execute(new TestComputationStepContext());
ArgumentCaptor<Context> contextArgumentCaptor = ArgumentCaptor.forClass(Context.class);
verify(check).onCheck(contextArgumentCaptor.capture());
assertThat(contextArgumentCaptor.getValue().getProjectUuid()).isEqualTo(project.getUuid());
}
use of org.sonar.ce.task.projectanalysis.measure.PostMeasuresComputationCheck.Context in project sonarqube by SonarSource.
the class PostMeasuresComputationChecksStepTest method ncloc_is_zero_in_context_when_not_available.
@Test
public void ncloc_is_zero_in_context_when_not_available() {
PostMeasuresComputationCheck check = mock(PostMeasuresComputationCheck.class);
newStep(check).execute(new TestComputationStepContext());
ArgumentCaptor<Context> contextArgumentCaptor = ArgumentCaptor.forClass(Context.class);
verify(check).onCheck(contextArgumentCaptor.capture());
assertThat(contextArgumentCaptor.getValue().getNcloc()).isZero();
}
Aggregations