use of org.sonar.ce.task.projectanalysis.component.Component in project sonarqube by SonarSource.
the class MutableMovedFilesRepositoryImplTest method getOriginalFile_returns_absent_for_any_type_of_Component_but_file_when_non_empty.
@Test
public void getOriginalFile_returns_absent_for_any_type_of_Component_but_file_when_non_empty() {
underTest.setOriginalFile(SOME_FILE, SOME_ORIGINAL_FILE);
for (Component component : COMPONENTS_EXCEPT_FILE) {
assertThat(underTest.getOriginalFile(component)).isEmpty();
}
assertThat(underTest.getOriginalFile(SOME_FILE)).contains(SOME_ORIGINAL_FILE);
}
use of org.sonar.ce.task.projectanalysis.component.Component in project sonarqube by SonarSource.
the class DuplicationRepositoryImplTest method addDuplication_inner_throws_IAE_if_file_type_is_not_FILE.
@Test
@UseDataProvider("allComponentTypesButFile")
public void addDuplication_inner_throws_IAE_if_file_type_is_not_FILE(Component.Type type) {
assertThatThrownBy(() -> {
Component component = mockComponentGetType(type);
underTest.add(component, SOME_DUPLICATION);
}).isInstanceOf(IllegalArgumentException.class).hasMessage("type of file must be FILE");
}
use of org.sonar.ce.task.projectanalysis.component.Component in project sonarqube by SonarSource.
the class DuplicationRepositoryImplTest method getDuplications_throws_IAE_if_Component_type_is_not_FILE.
@Test
@UseDataProvider("allComponentTypesButFile")
public void getDuplications_throws_IAE_if_Component_type_is_not_FILE(Component.Type type) {
assertThatThrownBy(() -> {
Component component = mockComponentGetType(type);
underTest.getDuplications(component);
}).isInstanceOf(IllegalArgumentException.class).hasMessage("type of file must be FILE");
}
use of org.sonar.ce.task.projectanalysis.component.Component in project sonarqube by SonarSource.
the class DuplicationRepositoryRule method addCrossProjectDuplication.
public DuplicationRepositoryRule addCrossProjectDuplication(int fileRef, TextBlock original, String otherFileKey, TextBlock duplicate) {
ensureComponentProviderInitialized();
Component component = componentProvider.getByRef(fileRef);
checkArgument(!componentRefsWithCrossProjectDuplications.containsEntry(component, original), "CrossProject duplications for file %s and original %s already set", fileRef);
componentRefsWithCrossProjectDuplications.put(component, original);
delegate.add(componentProvider.getByRef(fileRef), new Duplication(original, Collections.singletonList(new CrossProjectDuplicate(otherFileKey, duplicate))));
return this;
}
use of org.sonar.ce.task.projectanalysis.component.Component in project sonarqube by SonarSource.
the class DuplicationRepositoryRule method addExtendedProjectDuplication.
public DuplicationRepositoryRule addExtendedProjectDuplication(int fileRef, TextBlock original, int otherFileRef, TextBlock duplicate) {
ensureComponentProviderInitialized();
Component component = componentProvider.getByRef(fileRef);
checkArgument(!componentRefsWithCrossProjectDuplications.containsEntry(component, original), "CrossProject duplications for file %s and original %s already set", fileRef);
componentRefsWithCrossProjectDuplications.put(component, original);
delegate.add(componentProvider.getByRef(fileRef), new Duplication(original, Collections.singletonList(new InExtendedProjectDuplicate(componentProvider.getByRef(otherFileRef), duplicate))));
return this;
}
Aggregations