Skip to content

SLCORE-1550 Use ServerFixture for BindingSuggestionsMediumTests #1443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eray-felek-sonarsource
Copy link
Contributor

@eray-felek-sonarsource eray-felek-sonarsource commented Jul 24, 2025

@eray-felek-sonarsource eray-felek-sonarsource force-pushed the feautre/SLCORE-1550-utilize-serverfixture branch 2 times, most recently from a250733 to 41132cd Compare July 24, 2025 08:49
@eray-felek-sonarsource eray-felek-sonarsource force-pushed the feautre/SLCORE-1550-utilize-serverfixture branch from 41132cd to 78d522f Compare July 24, 2025 09:19
Copy link

sonarqube-next bot commented Jul 24, 2025

@eray-felek-sonarsource eray-felek-sonarsource marked this pull request as ready for review July 25, 2025 06:43
Copy link
Contributor

@damien-urruty-sonarsource damien-urruty-sonarsource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments to improve it even further

@@ -359,6 +354,9 @@ void should_suggest_binding_by_remote_url_when_no_other_suggestions_found(SonarL
var scServer = harness.newFakeSonarCloudServer()
.withOrganization("orgKey", organization ->
organization.withProject(SLCORE_PROJECT_KEY, project -> project.withBranch("main")))
.withDopTranslation(dop -> dop
.withProjectBinding(REMOTE_URL, PROJECT_ID, SLCORE_PROJECT_KEY)
.withSearchProjectsResponse("orgKey", PROJECT_ID, 200, "{\"components\":[{\"key\":\"" + SLCORE_PROJECT_KEY + "\",\"name\":\"" + SLCORE_PROJECT_NAME + "\"}]}\n"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would do this slightly differently. I think withDopTranslation and withProjectBinding are good, but I would remove withSearchProjectsResponse. Just above, there is already a call to organization.withProject, you could make sure this call registers a response to api/components/search_projects. You can also modify the project builder to add a withName. This would make the test even less verbose

@@ -619,24 +552,16 @@ void should_return_empty_when_sqs_server_project_is_not_present(SonarLintTestHar

var sqServer = harness.newFakeSonarQubeServer()
.withProject(SLCORE_PROJECT_KEY, project -> project.withBranch("main"))
.withDopTranslation(dop -> dop
.withProjectBinding(REMOTE_URL, PROJECT_ID, SLCORE_PROJECT_KEY)
.withComponentShowStatus(SLCORE_PROJECT_KEY, 404, "Project not found"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@eray-felek-sonarsource eray-felek-sonarsource marked this pull request as draft July 25, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants