Main { @VisibleForTesting static void execute(String[] args, System2 system) { Options options = Options.from(args); InputFileFinder fileFinder = new InputFileFinder(options.src(), options.tests(), options.exclusions(), StandardCharsets.UTF_8); SonarLintFactory sonarLintFactory = new SonarLintFactory(); int ret = new Main(options, sonarLintFactory, fileFinder, getProjectHome(system)).run(); system.exit(ret); } Main(Options opts, SonarLintFactory sonarLintFactory, InputFileFinder fileFinder, Path projectHome); static void main(String[] args);  }
@Test public void noPlugins() throws IOException { System2 sys = mock(System2.class); Path emptyDir = temp.newFolder().toPath(); when(sys.getProperty(SonarProperties.PROJECT_HOME)).thenReturn(emptyDir.toString()); Main.execute(new String[]{}, sys); verify(sys).exit(Main.ERROR); assertThat(getLogs(err)).contains("Error loading plugins"); }