use of org.sonar.server.exceptions.BadConfigurationException in project sonarqube by SonarSource.
the class WebServiceEngineTest method return_400_on_BadConfigurationException_with_single_message_and_scope.
@Test
public void return_400_on_BadConfigurationException_with_single_message_and_scope() {
Request request = new TestRequest().setPath("api/foo");
DumbResponse response = run(request, newWs("api/foo", a -> a.setHandler((req, resp) -> {
throw new BadConfigurationException("PROJECT", "Bad request !");
})));
assertThat(response.stream().outputAsString()).isEqualTo("{\"scope\":\"PROJECT\",\"errors\":[{\"msg\":\"Bad request !\"}]}");
assertThat(response.status()).isEqualTo(400);
assertThat(response.mediaType()).isEqualTo(MediaTypes.JSON);
assertThat(logTester.logs(LoggerLevel.ERROR)).isEmpty();
}
Aggregations