01: package net.sf.mockcreator;
02:
03: public class BugExpectThrowableTest extends TestCase {
04: MockBugExpectThrowable mock;
05:
06: public BugExpectThrowableTest(String name) {
07: super (name);
08: }
09:
10: public void setUp() throws Exception {
11: super .setUp();
12: mock = new MockBugExpectThrowable();
13: }
14:
15: public void testExpectThrowable() throws Exception {
16: mock.expectTestMethod().throwable(new Throwable());
17:
18: try {
19: mock.testMethod();
20: fail();
21: } catch (Throwable ex) {
22: // ok
23: }
24:
25: MockCore.verify();
26: }
27:
28: public void testExpectThrowableReturns() throws Throwable {
29: mock.expectTestMethod().returns(new Throwable());
30:
31: assertEquals(Throwable.class, mock.testMethod().getClass());
32:
33: MockCore.verify();
34: }
35: }
|