use of org.sonar.alm.client.azure.GsonAzureRepoList in project sonarqube by SonarSource.
the class SearchAzureReposActionTest method search_repos_with_projects_already_set_up_and_no_collision.
@Test
public void search_repos_with_projects_already_set_up_and_no_collision() {
mockClient(new GsonAzureRepoList(ImmutableList.of(getGsonAzureRepo("project-1", "repoName-1"), getGsonAzureRepo("project", "1-repoName-1"))));
AlmSettingDto almSetting = insertAlmSetting();
ProjectDto projectDto1 = insertProject(almSetting, "repoName-1", "project-1");
ProjectDto projectDto2 = insertProject(almSetting, "1-repoName-1", "project");
SearchAzureReposWsResponse response = ws.newRequest().setParam("almSetting", almSetting.getKey()).executeProtobuf(SearchAzureReposWsResponse.class);
assertThat(response.getRepositoriesCount()).isEqualTo(2);
assertThat(response.getRepositoriesList()).extracting(AzureRepo::getName, AzureRepo::getProjectName, AzureRepo::getSqProjectKey, AzureRepo::getSqProjectName).containsExactlyInAnyOrder(tuple("repoName-1", "project-1", projectDto1.getKey(), projectDto1.getName()), tuple("1-repoName-1", "project", projectDto2.getKey(), projectDto2.getName()));
}
Aggregations