1 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 name ) { 19 super(name); 20 } 21 22 public IsEqual eq( Object operand ) { 23 return new IsEqual(operand); 24 } 25 26 public IsEqual eq( boolean operand ) { 27 return eq(new Boolean (operand)); 28 } 29 30 public IsEqual eq( byte operand ) { 31 return eq(new Byte (operand)); 32 } 33 34 public IsEqual eq( short operand ) { 35 return eq(new Short (operand)); 36 } 37 38 public IsEqual eq( char operand ) { 39 return eq(new Character (operand)); 40 } 41 42 public IsEqual eq( int operand ) { 43 return eq(new Integer (operand)); 44 } 45 46 public IsEqual eq( long operand ) { 47 return eq(new Long (operand)); 48 } 49 50 public IsEqual eq( float operand ) { 51 return eq(new Float (operand)); 52 } 53 54 public IsEqual eq( double operand ) { 55 return eq(new Double (operand)); 56 } 57 58 public IsCloseTo eq( double operand, double error ) { 59 return new IsCloseTo(operand, error); 60 } 61 62 public IsSame same( Object operand ) { 63 return new IsSame(operand); 64 } 65 66 public IsInstanceOf isA( Class operandClass ) { 67 return new IsInstanceOf(operandClass); 68 } 69 70 public StringContains stringContains( String 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 newDummy( Class dummyType ) { 87 return Dummy.newDummy(dummyType); 88 } 89 90 public Object newDummy( Class dummyType, String name ) { 91 return Dummy.newDummy(dummyType, name); 92 } 93 94 public Object newDummy( String name ) { 95 return Dummy.newDummy(name); 96 } 97 } 98 99 | Popular Tags |