Skip to content

Conversation

@Meklo
Copy link
Contributor

@Meklo Meklo commented Jan 30, 2026

PR Summary

@Meklo Meklo requested a review from AbdelHedhili February 5, 2026 09:27
Comment on lines 160 to 162
public void verifyParametersDefault() {
WireMockUtilsCriteria.verifyPostRequest(wireMock, "/v1/parameters/default", Map.of());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should use the method that already exists (with the param nbRequests at 1) so we don't end up with twice the number of function needed.


public void stubGetResultCsv(String resultUuid, byte[] csvContent) {
wireMock.stubFor(WireMock.post(urlPathEqualTo("/v1/results/" + resultUuid + "/csv"))
.willReturn(aResponse()
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we switch from WireMock.ok() to aResponse().withStatus(200) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok is more readable I agree

}

public void stubParametersDefault(String statusJson) {
public void stubPostParametersDefault(String responseBody) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we already have it

public UUID stubParametersDefault(String responseBody) {
return wireMock.stubFor(WireMock.post(WireMock.urlPathEqualTo("/v1/parameters/default"))
.willReturn(WireMock.ok().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).withBody(responseBody))).getId();
}

Copy link
Contributor

Choose a reason for hiding this comment

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

we already have it

public UUID stubParametersDefault(String responseBody) {
return wireMock.stubFor(WireMock.post(WireMock.urlPathEqualTo("/v1/parameters/default"))
.willReturn(WireMock.ok().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).withBody(responseBody))).getId();
}

I don't think we should use the one from WireMockStubs, the goal is to remove all the methods that shoudn't be here in the first place so we need to put these functions in the appropriate Stubs class, which is what he did here. What we can do is remove this function from WireMockStubs but It's used elsewhere and it's not in the scope of this PR to change that in the other tests

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes that's what I suggested here #927 (comment)
But OK for cleaning in an other TS.

Copy link
Contributor Author

@Meklo Meklo Feb 10, 2026

Choose a reason for hiding this comment

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

I'll remove those in the deprecated class there's only one usage so it's fine

public void verifyParameterPut(WireMockServer wireMockServer, String paramUuid) {
wireMockServer.verify(
putRequestedFor(urlEqualTo("/v1/parameters/" + paramUuid))
putRequestedFor(urlEqualTo("/v1/parameters/" + paramUuid))
Copy link
Contributor

Choose a reason for hiding this comment

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

Try to keep previous indentation to preserve the Git history

WireMockUtilsCriteria.verifyPostRequest(wireMock, "/v1/parameters/default", Map.of(), nbRequests);
}

public void stubDeleteParameters(String parametersUuid) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should either delete parameters stubs from this class or from WireMockStubs but we shouldnt duplicate them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can delete the ones from WireMockStubs they don't seem widely used

null);
}

public void stubParameterPut(String paramUuid, String responseJson) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why in SC stubs file ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved those to computation stubs and deprecated pre existing faulty ones as discussed

@sonarqubecloud
Copy link

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