@BeforeClass
  public static void prepare() throws Exception {
    Path sonarlintUserHome = temp.newFolder().toPath();
    StandaloneGlobalConfiguration config =
        StandaloneGlobalConfiguration.builder()
            .addPlugin(PluginLocator.getJavaScriptPluginUrl())
            .addPlugin(PluginLocator.getJavaPluginUrl())
            .addPlugin(PluginLocator.getPhpPluginUrl())
            .addPlugin(PluginLocator.getPythonPluginUrl())
            .addPlugin(PluginLocator.getXooPluginUrl())
            .setSonarLintUserHome(sonarlintUserHome)
            .setLogOutput((msg, level) -> System.out.println(msg))
            .build();
    sonarlint = new StandaloneSonarLintEngineImpl(config);

    workDir = sonarlintUserHome.resolve("work");
    List<String> tmpFiles = Files.fileNamesIn(workDir.toString(), true);
    assertThat(tmpFiles).hasSize(1);
    assertThat(tmpFiles.get(0)).contains("sonar-plugin-api-deps");
  }
  @Test
  public void availableFoldersAreStoredInDiscoveryRequest() throws Exception {
    File temporaryFolder = Files.newTemporaryFolder();
    try {
      // @formatter:off
      TestDiscoveryRequest discoveryRequest =
          request().select(ClasspathSelector.forPath(temporaryFolder.getAbsolutePath())).build();
      // @formatter:on

      List<String> folders =
          discoveryRequest
              .getSelectorsByType(ClasspathSelector.class)
              .stream()
              .map(ClasspathSelector::getClasspathRoot)
              .map(File::getAbsolutePath)
              .collect(toList());

      assertThat(folders).contains(temporaryFolder.getAbsolutePath());
    } finally {
      temporaryFolder.delete();
    }
  }
 @AfterClass
 public static void stop() {
   sonarlint.stop();
   List<String> tmpFiles = Files.fileNamesIn(workDir.toString(), true);
   assertThat(tmpFiles).isEmpty();
 }