01: package net.sf.mockcreator;
02:
03: import net.sf.mockcreator.exceptions.MockException;
04: import net.sf.mockcreator.expectable.Ignore;
05: import net.sf.mockcreator.MockCore;
06:
07: public class BugExpectRunMixTest extends TestCase {
08: MockVoidVoid mock = new MockVoidVoid();
09:
10: MockRich rich = new MockRich();
11:
12: public void setUp() throws Exception {
13: MockCore.reset();
14: }
15:
16: public void testMixAfterExpect() throws Exception {
17: mock.expectVoidMethod();
18: mock.voidMethod();
19:
20: try {
21: mock.expectVoidMethod();
22: fail();
23: } catch (MockException ex) {
24: }
25:
26: MockCore.reset();
27: mock.expectVoidMethod();
28: }
29:
30: public void testMixAfterZOM() throws Exception {
31: mock.expectZeroOrMoreVoidMethod();
32: mock.voidMethod();
33:
34: try {
35: mock.expectVoidMethod();
36: fail();
37: } catch (MockException ex) {
38: }
39:
40: MockCore.reset();
41: mock.expectVoidMethod();
42: }
43:
44: public void testMixZOMAfterExpect() throws Exception {
45: mock.expectVoidMethod();
46: mock.voidMethod();
47:
48: try {
49: mock.expectZeroOrMoreVoidMethod();
50: fail();
51: } catch (MockException ex) {
52: }
53:
54: MockCore.reset();
55: mock.expectZeroOrMoreVoidMethod();
56: }
57:
58: public void testMixAfterAccept() throws Exception {
59: rich.acceptRich_int4D_returning_int(new Ignore()).returns(1);
60: rich.rich(null);
61:
62: try {
63: mock.expectVoidMethod();
64: fail();
65: } catch (MockException ex) {
66: }
67:
68: MockCore.reset();
69: mock.expectVoidMethod();
70: }
71: }
|