test_class.declarator: tmp = new TemporaryFolder()
test_class.modifier: public @Rule
test_class.original_string: public @Rule TemporaryFolder tmp = new TemporaryFolder();
test_class.type: TemporaryFolder
test_class.var_name: tmp
test_class.file: cli/src/test/java/com/github/olivergondza/dumpling/cli/SampleCommandTest.java
test_class.identifier: SampleCommandTest
test_class.superclass: extends AbstractCliTest
test_case.body: @Test
      public void outToFiles() throws Exception {
          File destination = tmp.newFolder();
          run(
                  "sample", "--number" , "3", "--out", destination.getAbsolutePath() + "/jstack",
                  "threaddump", "--in", "process:" + Util.currentPid()
          );
  
          assertThat(err.toString(), equalTo(""));
          assertThat(out.toString(), equalTo(""));
          assertThat(exitValue, equalTo(0));
  
          String[] outs = destination.list();
          assertThat(outs, arrayWithSize(3));
          for (String j : outs) {
              assertThat(j, startsWith("jstack"));
              new ThreadDumpFactory().fromFile(new File(destination, j));
          }
      }
test_case.class_method_signature: SampleCommandTest.outToFiles()
test_case.full_signature: @Test public void outToFiles()
test_case.identifier: outToFiles
test_case.invocations: newFolder run getAbsolutePath currentPid assertThat toString equalTo assertThat toString equalTo assertThat equalTo list assertThat arrayWithSize assertThat startsWith fromFile
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void outToFiles()
focal_class.declarator: number = -1
focal_class.modifier: private
focal_class.original_string: private int number = -1;
focal_class.type: int
focal_class.var_name: number
focal_class.declarator: output
focal_class.modifier: @Option(name = "--out", aliases = {"-o"}, usage = "Output files to write the result")
      public
focal_class.original_string: @Option(name = "--out", aliases = {"-o"}, usage = "Output files to write the result")
      public String output;
focal_class.type: String
focal_class.var_name: output
focal_class.declarator: interval = -1
focal_class.modifier: public
focal_class.original_string: public long interval = -1;
focal_class.type: long
focal_class.var_name: interval
focal_class.declarator: handler
focal_class.modifier: @Argument(required = true, metaVar = "COMMAND")
      private
focal_class.original_string: @Argument(required = true, metaVar = "COMMAND")
      private CliCommand handler;
focal_class.type: CliCommand
focal_class.var_name: handler
focal_class.file: cli/src/main/java/com/github/olivergondza/dumpling/cli/SampleCommand.java
focal_class.identifier: SampleCommand
focal_class.interfaces: implements CliCommand
focal_class.class_method_signature: SampleCommand.setNumber(int number)
focal_class.full_signature: @Option(name = "--number", aliases = {"-n"}, usage = "Number of samples to take") public void setNumber(int number)
focal_class.identifier: setNumber
focal_class.modifiers: @Option(name = "--number", aliases = {"-n"}, usage = "Number of samples to take") public
focal_class.parameters: (int number)
focal_class.return: void
focal_class.signature: void setNumber(int number)
focal_class.class_method_signature: SampleCommand.setInterval(String interval)
focal_class.full_signature: @Option(name = "--interval", aliases = {"-i"}, usage = "minimal wait time before invoking second sample") public void setInterval(String interval)
focal_class.identifier: setInterval
focal_class.modifiers: @Option(name = "--interval", aliases = {"-i"}, usage = "minimal wait time before invoking second sample") public
focal_class.parameters: (String interval)
focal_class.return: void
focal_class.signature: void setInterval(String interval)
focal_class.class_method_signature: SampleCommand.getName()
focal_class.full_signature: @Override @Nonnull public String getName()
focal_class.identifier: getName
focal_class.modifiers: @Override @Nonnull public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getName()
focal_class.class_method_signature: SampleCommand.getDescription()
focal_class.full_signature: @Override @Nonnull public String getDescription()
focal_class.identifier: getDescription
focal_class.modifiers: @Override @Nonnull public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getDescription()
focal_class.class_method_signature: SampleCommand.run(@Nonnull ProcessStream process)
focal_class.full_signature: @Override public int run(@Nonnull ProcessStream process)
focal_class.identifier: run
focal_class.modifiers: @Override public
focal_class.parameters: (@Nonnull ProcessStream process)
focal_class.return: int
focal_class.signature: int run(@Nonnull ProcessStream process)
focal_class.class_method_signature: SampleCommand.getOutStream(int i)
focal_class.full_signature: @CheckForNull private PrintStream getOutStream(int i)
focal_class.identifier: getOutStream
focal_class.modifiers: @CheckForNull private
focal_class.parameters: (int i)
focal_class.return: PrintStream
focal_class.signature: PrintStream getOutStream(int i)
focal_method.body: @Override
      public int run(@Nonnull ProcessStream process) throws CmdLineException {
          for (int i = 0; i < number; i++) {
              PrintStream customStdOut = getOutStream(i);
              try {
                  process = new ProcessStream(
                          process.in(),
                          customStdOut == null ? process.out() : customStdOut,
                          process.err()
                  );
                  handler.run(process);
              } finally {
                  if (customStdOut != null) customStdOut.close();
              }
          }
          return 0;
      }
focal_method.class_method_signature: SampleCommand.run(@Nonnull ProcessStream process)
focal_method.full_signature: @Override public int run(@Nonnull ProcessStream process)
focal_method.identifier: run
focal_method.invocations: getOutStream in out err run close
focal_method.modifiers: @Override public
focal_method.parameters: (@Nonnull ProcessStream process)
focal_method.return: int
focal_method.signature: int run(@Nonnull ProcessStream process)