01: package org.hanseltest;
02:
03: import junit.framework.TestCase;
04: import junit.framework.TestResult;
05:
06: import org.hansel.CoverageDecorator;
07:
08: /**
09: * This TestCase tests for a bug when using the jikes compiler and switch statements.
10: * The precompiled CoverSwitchBug class is contained in the "classes" directory.
11: */
12: public class TestSwitchBug extends TestCase {
13: /** Class to be covered by this test. */
14: private static final Class[] COVERED = { CoverSwitchBug.class };
15:
16: public void testBug() {
17: CoverageDecorator cd = new CoverageDecorator(
18: FullCoverage.class, COVERED);
19:
20: TestResult result = new TestResult();
21: cd.run(result);
22:
23: assertEquals(0, result.failureCount());
24: }
25:
26: public static class FullCoverage extends TestCase {
27:
28: public void testCase() {
29: CoverSwitchBug coverSwitchbug = new CoverSwitchBug();
30: coverSwitchbug.aCase(-1);
31: coverSwitchbug.aCase(1);
32: coverSwitchbug.aCase(2);
33: }
34: }
35:
36: }
|