@Test
  public void test() throws Exception {
    assertTrue(
        "SonarQube 5.1 is the minimum version to generate the issues report, change your orchestrator.properties",
        orchestrator.getConfiguration().getSonarVersion().isGreaterThanOrEquals("5.1"));
    File litsDifferencesFile = FileLocation.of("target/differences").getFile();
    SonarRunner build =
        SonarRunner.create(FileLocation.of("../sources/src").getFile())
            .setProjectKey("project")
            .setProjectName("project")
            .setProjectVersion("1")
            .setLanguage("js")
            .setSourceDirs("./")
            .setSourceEncoding("utf-8")
            .setProfile("rules")
            .setProperty("sonar.analysis.mode", "preview")
            .setProperty("sonar.issuesReport.html.enable", "true")
            .setProperty(
                "dump.old", FileLocation.of("src/test/expected").getFile().getAbsolutePath())
            .setProperty("dump.new", FileLocation.of("target/actual").getFile().getAbsolutePath())
            .setProperty("lits.differences", litsDifferencesFile.getAbsolutePath())
            .setProperty("sonar.cpd.skip", "true")
            .setEnvironmentVariable("SONAR_RUNNER_OPTS", "-Xmx1024m");
    orchestrator.executeBuild(build);

    assertThat(Files.toString(litsDifferencesFile, StandardCharsets.UTF_8)).isEmpty();
  }
 static {
   OrchestratorBuilder orchestratorBuilder =
       Orchestrator.builderEnv()
           // PHP Plugin
           .addPlugin(
               FileLocation.of(
                   Iterables.getOnlyElement(
                           Arrays.asList(
                               new File("../../../sonar-php-plugin/target/")
                                   .listFiles(
                                       new FilenameFilter() {
                                         @Override
                                         public boolean accept(File dir, String name) {
                                           return name.endsWith(".jar")
                                               && !name.endsWith("-sources.jar");
                                         }
                                       })))
                       .getAbsolutePath()))
           .restoreProfileAtStartup(FileLocation.ofClasspath(RESOURCE_DIRECTORY + "profile.xml"))
           // Custom rules plugin
           .addPlugin(
               FileLocation.of(
                   "../plugins/php-custom-rules-plugin/target/php-custom-rules-plugin-1.0-SNAPSHOT.jar"))
           .restoreProfileAtStartup(
               FileLocation.ofClasspath(RESOURCE_DIRECTORY + "profile-php-custom-rules.xml"));
   ORCHESTRATOR = orchestratorBuilder.build();
 }
 static {
   OrchestratorBuilder orchestratorBuilder =
       Orchestrator.builderEnv()
           .addPlugin("java")
           .addPlugin("checkstyle")
           .setMainPluginKey("checkstyle")
           .addPlugin(FileLocation.of(pluginJar("checkstyle-extension-plugin")))
           .restoreProfileAtStartup(
               FileLocation.ofClasspath(
                   "/com/sonar/it/java/CheckstyleExtensionsTest/extension-backup.xml"))
           .restoreProfileAtStartup(
               FileLocation.ofClasspath("/com/sonar/it/java/CheckstyleTest/checkstyle-backup.xml"))
           .restoreProfileAtStartup(
               FileLocation.ofClasspath(
                   "/com/sonar/it/java/CheckstyleTest/suppression-comment-filter.xml"))
           .restoreProfileAtStartup(
               FileLocation.ofClasspath(
                   "/com/sonar/it/java/CheckstyleTest/suppress-warnings-filter.xml"))
           .restoreProfileAtStartup(FileLocation.ofClasspath("/sonar-way-2.7.xml"));
   ORCHESTRATOR = orchestratorBuilder.build();
 }