1 package junitour;
2
3 import junit.framework.*;
4
5 import java.util.*;
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 public class TourTestResult extends TestResult {
43
44 protected Vector<TestFailure> fNotImplemented;
45 public static final int STATUS_INCOMPLETE= 3;
46 public TourTestResult() {
47 fNotImplemented = new Vector<TestFailure>();
48 }
49
50
51
52
53 public synchronized void addError(Test test, Throwable t) {
54 if( UnitTestIncompleteError.isTestIncompleteError(t) ) {
55 fNotImplemented.add(new TestFailure(test, t));
56 final Vector<TestListener> listeners = (Vector) fListeners.clone();
57 for (TestListener l: listeners) {
58 l.addError(test, t);
59 }
60 }
61 else
62 super.addError(test, t);
63 }
64
65 public synchronized void addFailure(Test test, AssertionFailedError t) {
66 if( UnitTestIncompleteError.isTestIncompleteError(t) ) {
67 fNotImplemented.add(new TestFailure(test, t));
68 final Vector<TestListener> listeners = (Vector) fListeners.clone();
69 for (TestListener l: listeners) {
70 l.addFailure(test, t);
71 }
72 }
73 else
74 super.addFailure(test, t);
75 }
76
77
78
79
80 public synchronized boolean allCompletlyImplemented() {
81 return notImplementedCount() == 0;
82 }
83
84
85
86
87 public synchronized int notImplementedCount() {
88 return fNotImplemented.size();
89 }
90
91
92
93
94 public synchronized Enumeration<TestFailure> incompletesEnum() {
95 return fNotImplemented.elements();
96 }
97 }