@Override public String toString() { return getMessage(); }
@Test public void should_create_exception() { String message = "the message"; MessageException exception = MessageException.of(message); assertThat(exception.getMessage()).isEqualTo(message); assertThat(exception).isInstanceOf(RuntimeException.class); }
@Test public void fail_if_conflicting_language_suffix() throws Exception { LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("xml", "xhtml"), new MockLanguage("web", "xhtml"))); LanguageDetection detection = new LanguageDetection(settings.asConfig(), languages); try { detectLanguage(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"); } }
@Test public void fail_if_conflicting_filepattern() throws Exception { LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("abap", "abap"), new MockLanguage("cobol", "cobol"))); settings.setProperty("sonar.lang.patterns.abap", "*.abap,*.txt"); settings.setProperty("sonar.lang.patterns.cobol", "*.cobol,*.txt"); LanguageDetection detection = new LanguageDetection(settings.asConfig(), languages); assertThat(detectLanguage(detection, "abc.abap")).isEqualTo("abap"); assertThat(detectLanguage(detection, "abc.cobol")).isEqualTo("cobol"); try { detectLanguage(detection, "abc.txt"); fail(); } catch (MessageException e) { assertThat(e.getMessage()) .contains("Language of file 'abc.txt' can not be decided as the file matches patterns of both ") .contains("sonar.lang.patterns.abap : *.abap,*.txt") .contains("sonar.lang.patterns.cobol : *.cobol,*.txt"); } }
@Override public String toString() { return getMessage(); }
@Override public String toString() { return getMessage(); }
StatusNotificationsMode i = gitLabPluginConfiguration.statusNotificationsMode(); if (i == StatusNotificationsMode.COMMIT_STATUS) { commitFacade.createOrUpdateSonarQubeStatus(MessageHelper.FAILED_GITLAB_STATUS, MessageHelper.sonarQubeFailed(e.getMessage()));