diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-11-19 15:44:12 +0100 |
---|---|---|
committer | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-11-20 14:27:53 +0100 |
commit | 509b374c3707ec346b2850369e90ad5e1d5e612d (patch) | |
tree | 079dae58ac145a92dc36189d8386fd2f3ef7b82d /sonar-batch/src/test | |
parent | b073a172839f58e8ef778365cac1ad3a7a21ef9c (diff) | |
download | sonarqube-509b374c3707ec346b2850369e90ad5e1d5e612d.tar.gz sonarqube-509b374c3707ec346b2850369e90ad5e1d5e612d.zip |
SONAR-6968 Bad error message when analyzer detects that no language plugins are installed
Diffstat (limited to 'sonar-batch/src/test')
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/NoLanguagesPluginsMediumTest.java | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/NoLanguagesPluginsMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/NoLanguagesPluginsMediumTest.java new file mode 100644 index 00000000000..5383725de4e --- /dev/null +++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/NoLanguagesPluginsMediumTest.java @@ -0,0 +1,76 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.batch.mediumtest.fs; + +import org.junit.rules.ExpectedException; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.filefilter.FileFilterUtils; +import org.sonar.batch.mediumtest.issuesmode.IssueModeAndReportsMediumTest; + +import java.io.File; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.Rule; +import org.junit.rules.TemporaryFolder; +import org.sonar.batch.mediumtest.BatchMediumTester; + +public class NoLanguagesPluginsMediumTest { + @Rule + public TemporaryFolder temp = new TemporaryFolder(); + + @Rule + public ExpectedException exception = ExpectedException.none(); + + public BatchMediumTester tester = BatchMediumTester.builder() + .setPreviousAnalysisDate(null) + .build(); + + @Before + public void prepare() { + tester.start(); + } + + @After + public void stop() { + tester.stop(); + } + + @Test + public void testNoLanguagePluginsInstalled() throws Exception { + File projectDir = copyProject("/mediumtest/xoo/sample"); + + exception.expect(IllegalStateException.class); + exception.expectMessage("No language plugins are installed"); + + tester + .newScanTask(new File(projectDir, "sonar-project.properties")) + .start(); + } + + private File copyProject(String path) throws Exception { + File projectDir = temp.newFolder(); + File originalProjectDir = new File(IssueModeAndReportsMediumTest.class.getResource(path).toURI()); + FileUtils.copyDirectory(originalProjectDir, projectDir, FileFilterUtils.notFileFilter(FileFilterUtils.nameFileFilter(".sonar"))); + return projectDir; + } +} |