use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class SendActionTest method executeRequest.
private void executeRequest(@Nullable String to, @Nullable String subject, @Nullable String message) {
TestRequest request = ws.newRequest();
if (to != null) {
request.setParam("to", to);
}
if (subject != null) {
request.setParam("subject", subject);
}
if (message != null) {
request.setParam("message", message);
}
request.execute();
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class AddActionTest method call.
private TestResponse call(@Nullable String componentKey) {
TestRequest request = ws.newRequest();
ofNullable(componentKey).ifPresent(c -> request.setParam(PARAM_COMPONENT, c));
return request.execute();
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class SearchActionTest method call.
private SearchResponse call(@Nullable Integer page, @Nullable Integer pageSize) {
TestRequest request = ws.newRequest().setMethod(POST.name());
ofNullable(page).ifPresent(p -> request.setParam(Param.PAGE, p.toString()));
ofNullable(pageSize).ifPresent(ps -> request.setParam(Param.PAGE_SIZE, ps.toString()));
return request.executeProtobuf(SearchResponse.class);
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class RemoveActionTest method call.
private TestResponse call(@Nullable String componentKey) {
TestRequest request = ws.newRequest();
ofNullable(componentKey).ifPresent(c -> request.setParam(PARAM_COMPONENT, c));
return request.execute();
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class AddCommentActionTest method fails_with_NotFoundException_if_issue_is_not_a_hotspot.
@Test
@UseDataProvider("ruleTypesByHotspot")
public void fails_with_NotFoundException_if_issue_is_not_a_hotspot(RuleType ruleType) {
ComponentDto project = dbTester.components().insertPublicProject();
ComponentDto file = dbTester.components().insertComponent(newFileDto(project));
RuleDefinitionDto rule = dbTester.rules().insert(t -> t.setType(ruleType));
IssueDto notAHotspot = dbTester.issues().insertIssue(rule, project, file, i -> i.setType(ruleType));
userSessionRule.logIn();
TestRequest request = newRequest(notAHotspot, randomAlphabetic(12));
assertThatThrownBy(request::execute).isInstanceOf(NotFoundException.class).hasMessage("Hotspot '%s' does not exist", notAHotspot.getKey());
}
Aggregations