### Question:
DefaultLocalExecutor implements CompilerExecutor { @Override public CompletableFuture<KieCompilationResponse> buildAndInstall(Path projectPath, String mavenRepoPath, String settingXML) { return internalBuild(projectPath, mavenRepoPath, settingXML, Boolean.FALSE, MavenCLIArgs.INSTALL); } DefaultLocalExecutor(ExecutorService executorService); @Override CompletableFuture<KieCompilationResponse> build(Path projectPath,
                                                           String mavenRepoPath,
                                                           String settingXML); @Override CompletableFuture<KieCompilationResponse> build(Path projectPath,
                                                           String mavenRepoPath,
                                                           String settingXML,
                                                           Map<Path, InputStream> override); @Override CompletableFuture<KieCompilationResponse> build(Path projectPath,
                                                           String mavenRepoPath,
                                                           String settingXML,
                                                           Boolean skipPrjDependenciesCreationList); @Override CompletableFuture<KieCompilationResponse> buildAndInstall(Path projectPath,
                                                                     String mavenRepoPath,
                                                                     String settingXML); @Override CompletableFuture<KieCompilationResponse> buildAndInstall(Path projectPath,
                                                                     String mavenRepoPath,
                                                                     String settingXML,
                                                                     Boolean skipPrjDependenciesCreationList); @Override CompletableFuture<KieCompilationResponse> buildSpecialized(Path projectPath,
                                                                      String mavenRepoPath,
                                                                      String[] args); @Override CompletableFuture<KieCompilationResponse> buildSpecialized(Path projectPath,
                                                                      String mavenRepoPath,
                                                                      String[] args,
                                                                      Boolean skipPrjDependenciesCreationList);  }### Answer:
@Test public void buildAndInstallNonExistentProject() throws Exception{ DefaultLocalExecutor executor = new DefaultLocalExecutor(executorService); CompletableFuture<KieCompilationResponse> futureRes = executor.buildAndInstall(tmpRoot, mavenRepoPath, TestUtilMaven.getSettingsFile()); KieCompilationResponse res = futureRes.get(); assertThat(res.isSuccessful()).isFalse(); }
@Test public void buildAndInstallSkipDepsNonExistentProject() throws Exception{ DefaultLocalExecutor executor = new DefaultLocalExecutor(executorService); CompletableFuture<KieCompilationResponse> futureRes = executor.buildAndInstall(tmpRoot, mavenRepoPath, TestUtilMaven.getSettingsFile(), Boolean.FALSE); KieCompilationResponse res = futureRes.get(); assertThat(res.isSuccessful()).isFalse(); assertThat(res.getDependencies()).isEmpty(); }
@Test public void buildAndInstallExistentProject() throws Exception{ DefaultLocalExecutor executor = new DefaultLocalExecutor(executorService); CompletableFuture<KieCompilationResponse> futureRes = executor.buildAndInstall(Paths.get(tmpRoot.toAbsolutePath()+"/dummy"), mavenRepoPath, TestUtilMaven.getSettingsFile()); KieCompilationResponse res = futureRes.get(); assertThat(res.isSuccessful()).isTrue(); assertThat(res.getDependencies()).isNotEmpty(); assertThat(res.getDependencies().size()).isGreaterThan(0); }
@Test public void buildAndInstallSkipDepsExistentProject() throws Exception{ DefaultLocalExecutor executor = new DefaultLocalExecutor(executorService); CompletableFuture<KieCompilationResponse> futureRes = executor.buildAndInstall(Paths.get(tmpRoot.toAbsolutePath()+"/dummy"), mavenRepoPath, TestUtilMaven.getSettingsFile(), Boolean.TRUE); KieCompilationResponse res = futureRes.get(); assertThat(res.isSuccessful()).isTrue(); assertThat(res.getDependencies()).isEmpty(); }