01: package net.sf.mockcreator;
02:
03: import net.sf.mockcreator.dumby.Dumby1;
04: import net.sf.mockcreator.dumby.LimitedDepth;
05: import net.sf.mockcreator.dumby.LimitedDepthSuper;
06: import net.sf.mockcreator.dumby.MockF1;
07: import net.sf.mockcreator.dumby.MockF2;
08: import net.sf.mockcreator.dumby.MockF3;
09: import net.sf.mockcreator.dumby.MockF4;
10: import net.sf.mockcreator.dumby.MockF5;
11: import net.sf.mockcreator.exceptions.MockException;
12:
13: public class DumbyTest extends TestCase {
14:
15: public DumbyTest(String name) {
16: super (name);
17: }
18:
19: public void setUp() throws Exception {
20: super .setUp();
21: }
22:
23: public void testAll() throws Exception {
24: MockF1 m1 = new MockF1();
25: MockF2 m2 = new MockF2();
26: MockF3 m3 = new MockF3();
27: MockF4 m4 = new MockF4();
28: MockF5 m5 = new MockF5();
29: }
30:
31: public void testMethods() throws Exception {
32: Dumby1 m1 = new Dumby1();
33: try {
34: m1.getFalse();
35: fail("Dumby shall throw an exception when any method called");
36: } catch (MockException ex) {
37: }
38: }
39:
40: public void testJavaLangObjectMethods() throws Exception {
41: Dumby1 m1 = new Dumby1();
42: m1.toString();
43: m1.equals(m1);
44: m1.hashCode();
45: }
46:
47: public void testFields() throws Exception {
48: Dumby1 m1 = new Dumby1();
49: assertFalse(m1.prop);
50: assertEquals("FOOBAR", Dumby1.FOOBAR);
51: }
52:
53: public void testDepth1() throws Exception {
54: try {
55: new LimitedDepth();
56: fail("shall dumbify only one level, not the whole tree");
57: } catch (IllegalStateException ex) {
58: assertEquals(LimitedDepthSuper.MESSAGE, ex.getMessage());
59: }
60: }
61: }
|