PipelineOptionsFactory { public static void printHelp(PrintStream out) { checkNotNull(out); out.println("The set of registered options are:"); Set<Class<? extends PipelineOptions>> sortedOptions = new TreeSet<>(ClassNameComparator.INSTANCE); sortedOptions.addAll(CACHE.get().registeredOptions); for (Class<? extends PipelineOptions> kls : sortedOptions) { out.format(" %s%n", kls.getName()); } out.format( "%nUse --help=<OptionsName> for detailed help. For example:%n" + " --help=DataflowPipelineOptions <short names valid for registered options>%n" + " --help=org.apache.beam.runners.dataflow.options.DataflowPipelineOptions%n"); }  static PipelineOptions create(); static T as(Class<T> klass); static Builder fromArgs(String... args); Builder withValidation(); static synchronized void register(Class<? extends PipelineOptions> iface); @Experimental static synchronized void resetCache(); static Set<Class<? extends PipelineOptions>> getRegisteredOptions(); static void printHelp(PrintStream out); static void printHelp(PrintStream out, Class<? extends PipelineOptions> iface); static List<PipelineOptionDescriptor> describe(
      Set<Class<? extends PipelineOptions>> ifaces);  }
@Test public void testProgrammaticPrintHelp() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PipelineOptionsFactory.printHelp(new PrintStream(baos)); String output = new String(baos.toByteArray(), Charsets.UTF_8); assertThat(output, containsString("The set of registered options are:")); assertThat(output, containsString("org.apache.beam.sdk.options.PipelineOptions")); }
@Test public void testProgrammaticPrintHelpForSpecificType() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PipelineOptionsFactory.printHelp(new PrintStream(baos), PipelineOptions.class); String output = new String(baos.toByteArray(), Charsets.UTF_8); assertThat(output, containsString("org.apache.beam.sdk.options.PipelineOptions")); assertThat(output, containsString("--runner")); assertThat(output, containsString("Default: " + DEFAULT_RUNNER_NAME)); assertThat( output, containsString("The pipeline runner that will be used to execute the pipeline.")); }