use of org.sonar.api.server.ws.WebService.NewController in project sonarqube by SonarSource.
the class WebServiceTest method fail_if_get_and_no_response_example.
@Test
public void fail_if_get_and_no_response_example() {
((WebService) context -> {
NewController newController = context.createController("api/rule");
newDefaultAction(newController, "list").setResponseExample(null);
newController.done();
}).define(context);
assertThat(logTester.logs(LoggerLevel.WARN)).contains("The response example is not set on action api/rule/list");
}
use of org.sonar.api.server.ws.WebService.NewController in project sonarqube by SonarSource.
the class WebServiceTest method fail_if_duplicated_action_parameters.
@Test
public void fail_if_duplicated_action_parameters() {
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage("The parameter 'key' is defined multiple times in the action 'create'");
((WebService) context -> {
NewController controller = context.createController("api/rule");
NewAction action = newDefaultAction(controller, "create");
action.createParam("key");
action.createParam("key");
controller.done();
}).define(context);
}
use of org.sonar.api.server.ws.WebService.NewController in project sonarqube by SonarSource.
the class WebServiceTest method log_if_action_description_is_empty.
@Test
public void log_if_action_description_is_empty() {
((WebService) context -> {
NewController newController = context.createController("api/rule");
newDefaultAction(newController, "list").setDescription("");
newController.done();
}).define(context);
assertThat(logTester.logs(LoggerLevel.WARN)).contains("Description is not set on action api/rule/list");
}
use of org.sonar.api.server.ws.WebService.NewController in project sonarqube by SonarSource.
the class WebServiceTest method log_if_action_description_is_null.
@Test
public void log_if_action_description_is_null() {
((WebService) context -> {
NewController newController = context.createController("api/rule");
newDefaultAction(newController, "list").setDescription(null);
newController.done();
}).define(context);
assertThat(logTester.logs(LoggerLevel.WARN)).contains("Description is not set on action api/rule/list");
}
use of org.sonar.api.server.ws.WebService.NewController in project sonarqube by SonarSource.
the class WebServiceTest method fail_if_duplicated_action_keys.
@Test
public void fail_if_duplicated_action_keys() {
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage("The action 'delete' is defined multiple times in the web service 'rule'");
((WebService) context -> {
NewController newController = context.createController("rule");
newDefaultAction(newController, "create");
newDefaultAction(newController, "delete");
newDefaultAction(newController, "delete");
newController.done();
}).define(context);
}
Aggregations