use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class EditCommentActionTest method fails_if_comment_with_provided_key_does_not_exist.
@Test
public void fails_if_comment_with_provided_key_does_not_exist() {
userSessionRule.logIn();
TestRequest request = newRequest("not-existing-comment-key", "some new comment");
assertThatThrownBy(request::execute).isInstanceOf(NotFoundException.class).hasMessage("Comment with key 'not-existing-comment-key' does not exist");
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class ShowActionTest method fails_with_IAE_if_parameter_hotspot_is_missing.
@Test
public void fails_with_IAE_if_parameter_hotspot_is_missing() {
TestRequest request = actionTester.newRequest();
assertThatThrownBy(request::execute).isInstanceOf(IllegalArgumentException.class).hasMessage("The 'hotspot' parameter is missing");
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class ShowActionTest method fails_with_ForbiddenException_if_project_is_private_and_not_allowed.
@Test
public void fails_with_ForbiddenException_if_project_is_private_and_not_allowed() {
ComponentDto project = dbTester.components().insertPrivateProject();
userSessionRule.registerComponents(project);
ComponentDto file = dbTester.components().insertComponent(newFileDto(project));
RuleDefinitionDto rule = newRule(SECURITY_HOTSPOT);
IssueDto hotspot = dbTester.issues().insertHotspot(rule, project, file);
TestRequest request = newRequest(hotspot);
assertThatThrownBy(request::execute).isInstanceOf(ForbiddenException.class).hasMessage("Insufficient privileges");
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class ShowActionTest method fails_with_NotFoundException_if_issue_is_hotspot_is_closed.
@Test
public void fails_with_NotFoundException_if_issue_is_hotspot_is_closed() {
ComponentDto project = dbTester.components().insertPublicProject();
ComponentDto file = dbTester.components().insertComponent(newFileDto(project));
RuleDefinitionDto rule = newRule(SECURITY_HOTSPOT);
IssueDto hotspot = dbTester.issues().insertHotspot(rule, project, file, t -> t.setStatus(Issue.STATUS_CLOSED));
TestRequest request = newRequest(hotspot);
assertThatThrownBy(request::execute).isInstanceOf(NotFoundException.class).hasMessage("Hotspot '%s' does not exist", hotspot.getKey());
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class SearchActionTest method fails_with_IAE_if_resolution_is_provided_with_status_TO_REVIEW.
@Test
@UseDataProvider("fixedOrSafeResolution")
public void fails_with_IAE_if_resolution_is_provided_with_status_TO_REVIEW(String resolution) {
TestRequest request = actionTester.newRequest().setParam("projectKey", randomAlphabetic(13)).setParam("status", STATUS_TO_REVIEW).setParam("resolution", resolution);
assertThatThrownBy(request::execute).isInstanceOf(IllegalArgumentException.class).hasMessage("Value '" + resolution + "' of parameter 'resolution' can only be provided if value of parameter 'status' is 'REVIEWED'");
}
Aggregations