Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

NoLanguagesPluginsMediumIT.java 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2024 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  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.
  10. *
  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.
  15. *
  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.
  19. */
  20. package org.sonar.scanner.mediumtest.fs;
  21. import java.io.File;
  22. import org.apache.commons.io.FileUtils;
  23. import org.apache.commons.io.filefilter.FileFilterUtils;
  24. import org.junit.Rule;
  25. import org.junit.Test;
  26. import org.junit.rules.TemporaryFolder;
  27. import org.sonar.scanner.mediumtest.ScannerMediumTester;
  28. import static org.assertj.core.api.Assertions.assertThatThrownBy;
  29. public class NoLanguagesPluginsMediumIT {
  30. @Rule
  31. public TemporaryFolder temp = new TemporaryFolder();
  32. @Rule
  33. public ScannerMediumTester tester = new ScannerMediumTester();
  34. @Test
  35. public void testNoLanguagePluginsInstalled() throws Exception {
  36. File projectDir = copyProject("test-resources/mediumtest/xoo/sample");
  37. assertThatThrownBy(() -> tester
  38. .newAnalysis(new File(projectDir, "sonar-project.properties"))
  39. .execute())
  40. .isInstanceOf(IllegalStateException.class)
  41. .hasMessage("No language plugins are installed.");
  42. }
  43. private File copyProject(String path) throws Exception {
  44. File projectDir = temp.newFolder();
  45. File originalProjectDir = new File(path);
  46. FileUtils.copyDirectory(originalProjectDir, projectDir, FileFilterUtils.notFileFilter(FileFilterUtils.nameFileFilter(".sonar")));
  47. return projectDir;
  48. }
  49. }