PrintStreamEmbedderMonitor.java

  1. package org.jbehave.core.embedder;

  2. import java.io.PrintStream;

  3. import org.jbehave.core.reporters.Format;

  4. /**
  5.  * Monitor that reports to a {@link PrintStream}, defaulting to {@link System#out}
  6.  */
  7. public class PrintStreamEmbedderMonitor extends PrintingEmbedderMonitor {

  8.     private PrintStream output;

  9.     public PrintStreamEmbedderMonitor() {
  10.         this(System.out);
  11.     }

  12.     public PrintStreamEmbedderMonitor(PrintStream output) {
  13.         this.output = output;
  14.     }

  15.     @Override
  16.     protected void print(String format, Object... args) {
  17.         Format.println(output, format, args);
  18.     }

  19.     @Override
  20.     protected void printStackTrace(Throwable e) {
  21.         e.printStackTrace(output);
  22.     }
  23. }