use of org.sonar.api.config.MapSettings in project sonarqube by SonarSource.
the class LanguageDetectionTest method fail_if_conflicting_filepattern.
@Test
public void fail_if_conflicting_filepattern() throws Exception {
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("abap", "abap"), new MockLanguage("cobol", "cobol")));
Settings settings = new MapSettings();
settings.setProperty("sonar.lang.patterns.abap", "*.abap,*.txt");
settings.setProperty("sonar.lang.patterns.cobol", "*.cobol,*.txt");
LanguageDetection detection = new LanguageDetection(settings, languages);
assertThat(detection.language(newIndexedFile("abc.abap"))).isEqualTo("abap");
assertThat(detection.language(newIndexedFile("abc.cobol"))).isEqualTo("cobol");
try {
detection.language(newIndexedFile("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");
}
}
use of org.sonar.api.config.MapSettings in project sonarqube by SonarSource.
the class LanguageDetectionTest method should_not_fail_if_no_language.
@Test
public void should_not_fail_if_no_language() throws Exception {
LanguageDetection detection = spy(new LanguageDetection(new MapSettings(), new DefaultLanguagesRepository(new Languages())));
assertThat(detection.language(newIndexedFile("Foo.java"))).isNull();
}
use of org.sonar.api.config.MapSettings in project sonarqube by SonarSource.
the class ProjectReactorValidatorTest method prepare.
@Before
public void prepare() {
mode = mock(DefaultAnalysisMode.class);
settings = new MapSettings();
validator = new ProjectReactorValidator(settings, mode);
}
Aggregations