use of org.sonar.api.server.ws.internal.ValidatingRequest in project sonarqube by SonarSource.
the class WebServiceEngineTest method param_value_is_in_possible_values.
@Test
public void param_value_is_in_possible_values() {
ValidatingRequest request = new TestRequest().setMethod("GET").setPath("/api/system/print").setParam("message", "Hello World").setParam("format", "json");
DumbResponse response = new DumbResponse();
underTest.execute(request, response);
assertThat(response.stream().outputAsString()).isEqualTo("Hello World by -");
}
use of org.sonar.api.server.ws.internal.ValidatingRequest in project sonarqube by SonarSource.
the class WebServiceEngineTest method bad_controller_with_no_action.
@Test
public void bad_controller_with_no_action() {
ValidatingRequest request = new TestRequest().setMethod("GET").setPath("/api/bad");
DumbResponse response = new DumbResponse();
underTest.execute(request, response);
assertThat(response.stream().outputAsString()).isEqualTo("{\"errors\":[{\"msg\":\"Unknown url : /api/bad\"}]}");
assertThat(response.stream().status()).isEqualTo(404);
}
use of org.sonar.api.server.ws.internal.ValidatingRequest in project sonarqube by SonarSource.
the class WebServiceEngineTest method optional_parameter_is_set.
@Test
public void optional_parameter_is_set() {
ValidatingRequest request = new TestRequest().setMethod("GET").setPath("/api/system/print").setParam("message", "Hello World").setParam("author", "Marcel");
DumbResponse response = new DumbResponse();
underTest.execute(request, response);
assertThat(response.stream().outputAsString()).isEqualTo("Hello World by Marcel");
}
Aggregations