KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jmock > core > MockObjectSupportTestCase


1 /* Copyright (c) 2000-2004 jMock.org
2  */

3 package org.jmock.core;
4
5 import org.jmock.core.constraint.*;
6 import org.jmock.util.Dummy;
7
8
9 public abstract class MockObjectSupportTestCase extends VerifyingTestCase
10 {
11     public static final Constraint ANYTHING = new IsAnything();
12     public static final Constraint NULL = new IsNull();
13     public static final Constraint NOT_NULL = new IsNot(NULL);
14     
15     public MockObjectSupportTestCase() {
16     }
17
18     public MockObjectSupportTestCase( String JavaDoc name ) {
19         super(name);
20     }
21
22     public IsEqual eq( Object JavaDoc operand ) {
23         return new IsEqual(operand);
24     }
25
26     public IsEqual eq( boolean operand ) {
27         return eq(new Boolean JavaDoc(operand));
28     }
29
30     public IsEqual eq( byte operand ) {
31         return eq(new Byte JavaDoc(operand));
32     }
33
34     public IsEqual eq( short operand ) {
35         return eq(new Short JavaDoc(operand));
36     }
37
38     public IsEqual eq( char operand ) {
39         return eq(new Character JavaDoc(operand));
40     }
41
42     public IsEqual eq( int operand ) {
43         return eq(new Integer JavaDoc(operand));
44     }
45
46     public IsEqual eq( long operand ) {
47         return eq(new Long JavaDoc(operand));
48     }
49
50     public IsEqual eq( float operand ) {
51         return eq(new Float JavaDoc(operand));
52     }
53
54     public IsEqual eq( double operand ) {
55         return eq(new Double JavaDoc(operand));
56     }
57
58     public IsCloseTo eq( double operand, double error ) {
59         return new IsCloseTo(operand, error);
60     }
61
62     public IsSame same( Object JavaDoc operand ) {
63         return new IsSame(operand);
64     }
65
66     public IsInstanceOf isA( Class JavaDoc operandClass ) {
67         return new IsInstanceOf(operandClass);
68     }
69
70     public StringContains stringContains( String JavaDoc substring ) {
71         return new StringContains(substring);
72     }
73
74     public IsNot not( Constraint c ) {
75         return new IsNot(c);
76     }
77
78     public And and( Constraint left, Constraint right ) {
79         return new And(left, right);
80     }
81
82     public Or or( Constraint left, Constraint right ) {
83         return new Or(left, right);
84     }
85
86     public Object JavaDoc newDummy( Class JavaDoc dummyType ) {
87         return Dummy.newDummy(dummyType);
88     }
89
90     public Object JavaDoc newDummy( Class JavaDoc dummyType, String JavaDoc name ) {
91         return Dummy.newDummy(dummyType, name);
92     }
93
94     public Object JavaDoc newDummy( String JavaDoc name ) {
95         return Dummy.newDummy(name);
96     }
97 }
98
99
Popular Tags