CaliperMain { @VisibleForTesting public static CaliperRunner createRunner(String[] args, PrintWriter stdout, PrintWriter stderr) { return DaggerJvmCaliperRunnerComponent.builder() .optionsModule(OptionsModule.withBenchmarkClass(args)) .outputModule(new OutputModule(stdout, stderr)) .build() .getRunner(); }  static void main(Class<?> benchmarkClass, String[] args); static void main(String[] args); static void exitlessMain(String[] args, PrintWriter stdout, PrintWriter stderr); @VisibleForTesting static CaliperRunner createRunner(String[] args, PrintWriter stdout, PrintWriter stderr);  }
@Test public void testHelp() throws Exception { StringWriter out = new StringWriter(); StringWriter err = new StringWriter(); int exitCode = CaliperMain.createRunner( new String[] {"-h"}, new PrintWriter(out, true), new PrintWriter(err, true)) .run(); assertThat(exitCode).isEqualTo(0); assertThat(out.toString()) .startsWith("Usage:\n java com.google.caliper.runner.CaliperMain <benchmark_class_name>"); assertThat(err.toString()).isEmpty(); }