| 1 | |
package org.jbehave.core.configuration; |
| 2 | |
|
| 3 | |
import java.io.PrintStream; |
| 4 | |
import java.lang.annotation.Annotation; |
| 5 | |
|
| 6 | |
import org.jbehave.core.reporters.Format; |
| 7 | |
|
| 8 | |
public class PrintStreamAnnotationMonitor extends NullAnnotationMonitor { |
| 9 | |
|
| 10 | |
private final PrintStream output; |
| 11 | |
|
| 12 | |
public PrintStreamAnnotationMonitor() { |
| 13 | 17 | this(System.out); |
| 14 | 17 | } |
| 15 | |
|
| 16 | 20 | public PrintStreamAnnotationMonitor(PrintStream output) { |
| 17 | 20 | this.output = output; |
| 18 | 20 | } |
| 19 | |
|
| 20 | |
public void elementCreationFailed(Class<?> elementClass, Exception cause) { |
| 21 | 2 | Format.println(output, "Element creation failed: " + elementClass); |
| 22 | 2 | cause.printStackTrace(output); |
| 23 | 2 | } |
| 24 | |
|
| 25 | |
public void annotationNotFound(Class<? extends Annotation> annotation, Object annotatedInstance) { |
| 26 | 4 | Format.println(output, "Annotation " + annotation + " not found in " + annotatedInstance); |
| 27 | 4 | } |
| 28 | |
|
| 29 | |
} |