@Test public void errorStart() throws IOException { Exception e = createException("invalid operation", "analysis failed"); doThrow(e).when(sonarLint).runAnalysis(anyMapOf(String.class, String.class), any(InputFileFinder.class), any(Path.class)); assertThat(main.run()).isEqualTo(Main.ERROR); assertThat(getLogs(err)).contains("invalid operation"); }
int run() { try { StandaloneSonarLint sonarLint = sonarLintFactory.createSonarLint(); Map<String, String> props = Util.toMap(opts.properties()); runOnce(sonarLint, props, projectHome); } catch (Exception e) { LOGGER.error("Error executing Analysis", e); return ERROR; } return SUCCESS; }
Main { int run() { try { StandaloneSonarLint sonarLint = sonarLintFactory.createSonarLint(); Map<String, String> props = Util.toMap(opts.properties()); runOnce(sonarLint, props, projectHome); } catch (Exception e) { LOGGER.error("Error executing Analysis", e); return ERROR; } return SUCCESS; } }
Main { int run() { try { StandaloneSonarLint sonarLint = sonarLintFactory.createSonarLint(); Map<String, String> props = Util.toMap(opts.properties()); runOnce(sonarLint, props, projectHome); } catch (Exception e) { LOGGER.error("Error executing Analysis", e); return ERROR; } return SUCCESS; } Main(Options opts, SonarLintFactory sonarLintFactory, InputFileFinder fileFinder, Path projectHome); }
Main { int run() { try { StandaloneSonarLint sonarLint = sonarLintFactory.createSonarLint(); Map<String, String> props = Util.toMap(opts.properties()); runOnce(sonarLint, props, projectHome); } catch (Exception e) { LOGGER.error("Error executing Analysis", e); return ERROR; } return SUCCESS; } Main(Options opts, SonarLintFactory sonarLintFactory, InputFileFinder fileFinder, Path projectHome); static void main(String[] args); }
Main { int run() { try { StandaloneSonarLint sonarLint = sonarLintFactory.createSonarLint(); Map<String, String> props = Util.toMap(opts.properties()); runOnce(sonarLint, props, projectHome); } catch (Exception e) { LOGGER.error("Error executing Analysis", e); return ERROR; } return SUCCESS; } Main(Options opts, SonarLintFactory sonarLintFactory, InputFileFinder fileFinder, Path projectHome); static void main(String[] args);  }