1 package com.atlassian.performance.junit;
2
3 import com.atlassian.performance.PerformanceReporter;
4 import junit.framework.AssertionFailedError;
5 import junit.framework.Test;
6 import junit.framework.TestListener;
7
8 public class PerformanceListener implements TestListener {
9 private final PerformanceReporter reporter;
10
11 public PerformanceListener(PerformanceReporter reporter) {
12 this.reporter = reporter;
13 }
14
15 public void addError(Test test, Throwable t) {
16 }
17
18 public void addFailure(Test test, AssertionFailedError t) {
19 }
20
21 public void endTest(Test test) {
22 if (test instanceof PerformanceTest) {
23 reporter.addRecorder(((PerformanceTest) test).getRecorder());
24 }
25 }
26
27 public void startTest(Test test) {
28 }
29
30 public PerformanceReporter getReporter() {
31 return reporter;
32 }
33
34 }