use of org.sonar.api.utils.MessageException in project sonarqube by SonarSource.
the class LanguageDetectionTest method fail_if_conflicting_language_suffix.
@Test
public void fail_if_conflicting_language_suffix() {
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("xml", "xhtml"), new MockLanguage("web", "xhtml")));
LanguageDetection detection = new LanguageDetection(settings.asConfig(), languages);
try {
detectLanguageKey(detection, "abc.xhtml");
fail();
} catch (MessageException e) {
assertThat(e.getMessage()).contains("Language of file 'abc.xhtml' can not be decided as the file matches patterns of both ").contains("sonar.lang.patterns.web : **/*.xhtml").contains("sonar.lang.patterns.xml : **/*.xhtml");
}
}
use of org.sonar.api.utils.MessageException in project sonarqube by SonarSource.
the class DefaultProjectRepositoriesLoaderTest method failFastHttpErrorMessageException.
@Test
public void failFastHttpErrorMessageException() {
HttpException http = new HttpException("uri", 403, null);
MessageException e = MessageException.of("http error", http);
WsTestUtil.mockException(wsClient, e);
assertThatThrownBy(() -> loader.load(PROJECT_KEY, null)).isInstanceOf(MessageException.class).hasMessage("http error");
}
Aggregations