3 * Copyright (C) 2009-2017 SonarSource SA
4 * mailto:info AT sonarsource DOT com
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 package org.sonar.scanner.mediumtest.fs;
23 import org.apache.commons.io.FileUtils;
24 import org.apache.commons.io.filefilter.FileFilterUtils;
25 import org.junit.After;
26 import org.junit.Before;
27 import org.junit.Rule;
28 import org.junit.Test;
29 import org.junit.rules.ExpectedException;
30 import org.junit.rules.TemporaryFolder;
31 import org.sonar.scanner.mediumtest.ScannerMediumTester;
32 import org.sonar.scanner.mediumtest.issuesmode.IssueModeAndReportsMediumTest;
34 public class NoLanguagesPluginsMediumTest {
36 public TemporaryFolder temp = new TemporaryFolder();
39 public ExpectedException exception = ExpectedException.none();
41 public ScannerMediumTester tester = ScannerMediumTester.builder()
42 .setPreviousAnalysisDate(null)
46 public void prepare() {
56 public void testNoLanguagePluginsInstalled() throws Exception {
57 File projectDir = copyProject("/mediumtest/xoo/sample");
59 exception.expect(IllegalStateException.class);
60 exception.expectMessage("No language plugins are installed");
63 .newScanTask(new File(projectDir, "sonar-project.properties"))
67 private File copyProject(String path) throws Exception {
68 File projectDir = temp.newFolder();
69 File originalProjectDir = new File(IssueModeAndReportsMediumTest.class.getResource(path).toURI());
70 FileUtils.copyDirectory(originalProjectDir, projectDir, FileFilterUtils.notFileFilter(FileFilterUtils.nameFileFilter(".sonar")));