1 package junitour.subpackage;
2
3 import junit.framework.*;
4 import junit.textui.ResultPrinter;
5
6 import junitour.MyResultPrinter;
7 import junitour.TourTestResult;
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 public class ErrorTest extends TestCase {
28
29 public ErrorTest() {
30 }
31
32 public void testDefinitlyProducesAnError() throws Exception {
33 throw new Exception("This produces this error!");
34 }
35
36 public static void main(String[] args) {
37 runTextUI();
38
39
40 }
41
42 private static void runTextUI() {
43 ResultPrinter resPrinter = new MyResultPrinter(System.out);
44 final junit.textui.TestRunner testRunner = new junit.textui.TestRunner(resPrinter) {
45 protected TestResult createTestResult() {
46 return new TourTestResult();
47 }
48 };
49 testRunner.doRun(suite());
50 }
51
52
53
54
55
56 public static TestSuite suite() {
57 return new TestSuite(ErrorTest.class);
58 }
59
60 }
61