-
Notifications
You must be signed in to change notification settings - Fork 0
/
Chapter11.java
110 lines (82 loc) · 2.44 KB
/
Chapter11.java
1
2
3
4
5
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package org.bitcamp.ex11;
import junit.framework.AssertionFailedError;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestListener;
import junit.framework.TestResult;
public class Chapter11 extends TestCase {
public void testChapter11() {
System.out.println("- TestCase::testChapter11() invoked.");
System.out.println("Hello");
// throw new RuntimeException("testChapter11");
assertTrue(false);
} // testChapter11
@Override
public int countTestCases() {
// System.out.println("- TestCase::countTestCase() invoked.");
return super.countTestCases();
}
@Override
protected TestResult createResult() {
System.out.println("- TestCase::createResult() invoked.");
return super.createResult();
}
@Override
public TestResult run() {
System.out.println("- TestCase::run() invoked.");
return super.run();
}
@Override
public void run(TestResult result) {
System.out.println("- TestCase::run("+result+") invoked.");
result.addListener(new TestListener() {
@Override
public void addError(Test test, Throwable t) {
System.out.println("\t- TestListender::addError("+test+","+t+") invoked.");
}
@Override
public void addFailure(Test test, AssertionFailedError t) {
System.out.println("\t- TestListender::addFailure("+test+","+t+") invoked.");
}
@Override
public void endTest(Test test) {
System.out.println("\t- TestListender::endTest("+test+") invoked.");
}
@Override
public void startTest(Test test) {
System.out.println("\t- TestListender::startTest("+test+") invoked.");
} // startTest
}); //addListener
super.run(result);
}
@Override
public void runBare() throws Throwable {
System.out.println("- TestCase::runBare() invoked.");
super.runBare();
}
@Override
protected void runTest() throws Throwable {
System.out.println("- TestCase::runTest() invoked.");
super.runTest();
}
@Override
protected void setUp() throws Exception {
System.out.println("- TestCase::setUp() invoked.");
super.setUp();
}
@Override
protected void tearDown() throws Exception {
System.out.println("- TestCase::tearDown() invoked.");
super.tearDown();
}
@Override
public String getName() {
// System.out.println("- TestCase::getName() invoked.");
return super.getName();
}
@Override
public void setName(String name) {
System.out.println("- TestCase::setName("+name+") invoked.");
super.setName(name);
}
}