|
jDummy | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object junit.framework.Assert junit.framework.TestCase org.jmock.core.VerifyingTestCase org.jmock.core.MockObjectSupportTestCase org.jmock.MockObjectTestCase org.jmock.cglib.MockObjectTestCase net.sf.jdummy.JDummyTestCase
public class JDummyTestCase
A base class for tests that use jDummy syntax. This class provides methods for creating mock objects (optionally with dummy value generating default stubs), preconditions and expectations.
Field Summary | |
---|---|
protected DummyValueFactory |
dummyValueFactory
|
protected Mockery |
mockery
|
Fields inherited from class org.jmock.core.MockObjectSupportTestCase |
---|
ANYTHING, NOT_NULL, NULL |
Constructor Summary | |
---|---|
JDummyTestCase()
|
Method Summary | |
---|---|
Mock |
assertBehavior(java.lang.Object dummy)
Gets the mock whose proxy()is dummy so that you may add expectations. |
java.util.Collection |
fillWithDummies(java.util.Collection collection,
java.lang.Class type,
int count)
Fills the collection with count new dummies |
java.lang.Object |
fillWithDummies(java.lang.Object array)
Fills an array with dummies or random values of a given type. |
java.lang.Object[] |
fillWithDummies(java.lang.Object[] array)
Fills an array of object swith dummies values of a given type. |
Generator |
getGenerator(java.lang.Class type)
|
java.lang.Object |
mimic(java.lang.Class type)
Create a new mock and return its proxy. |
java.lang.Object |
mimic(java.lang.Class type,
java.lang.String name)
|
java.lang.Object |
mimicWithDummyValues(java.lang.Class type)
Returns new dummy with a unique name |
java.lang.Object |
mimicWithDummyValues(java.lang.Class type,
java.lang.String name)
Creates a new mock object of the given type with the given name and dummy value method results. |
Mock |
mockForProxy(java.lang.Object dummy)
|
java.lang.String |
nextName(java.lang.String baseName)
Gets the next value of the sequence baseName + "-" + i |
java.lang.Object |
pickOne(java.lang.Object[] choices)
|
NameMatchBuilder |
precondition(java.lang.Object dummy)
Gets the stubs() mock whose proxy()is dummy. |
Stub |
returnOneOf(java.util.Collection choices)
|
Stub |
returnOneOf(java.lang.Object[] choices)
A stub that is useful for methods returning enumerations. |
void |
setGenerator(java.lang.Class type,
Generator generator)
|
void |
setSeed(long seed)
|
Methods inherited from class org.jmock.cglib.MockObjectTestCase |
---|
newCoreMock |
Methods inherited from class org.jmock.MockObjectTestCase |
---|
atLeastOnce, defaultMockNameForType, mock, mock, never, once, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, throwException |
Methods inherited from class org.jmock.core.MockObjectSupportTestCase |
---|
and, eq, eq, eq, eq, eq, eq, eq, eq, eq, eq, isA, newDummy, newDummy, newDummy, not, or, same, stringContains |
Methods inherited from class org.jmock.core.VerifyingTestCase |
---|
registerToVerify, runBare, unregisterToVerify, verify |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runTest, setName, setUp, tearDown, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Mockery mockery
protected DummyValueFactory dummyValueFactory
Constructor Detail |
---|
public JDummyTestCase()
Method Detail |
---|
public java.lang.Object mimic(java.lang.Class type)
type
-
public java.lang.Object mimic(java.lang.Class type, java.lang.String name)
public java.lang.Object mimicWithDummyValues(java.lang.Class type, java.lang.String name)
type
- name
-
public java.lang.Object mimicWithDummyValues(java.lang.Class type)
type
-
public Mock assertBehavior(java.lang.Object dummy)
dummy
-
public NameMatchBuilder precondition(java.lang.Object dummy)
dummy
-
public Stub returnOneOf(java.lang.Object[] choices)
precondition(dummy).method("foo").will(returnOneOf(MyEnum.values))
choices
- an array
public java.lang.Object pickOne(java.lang.Object[] choices)
public Stub returnOneOf(java.util.Collection choices)
choices
-
returnOneOf(Object[])
public java.lang.Object fillWithDummies(java.lang.Object array)
array
-
public java.lang.Object[] fillWithDummies(java.lang.Object[] array)
array
-
public java.util.Collection fillWithDummies(java.util.Collection collection, java.lang.Class type, int count)
collection
- type
- count
-
public Generator getGenerator(java.lang.Class type)
public Mock mockForProxy(java.lang.Object dummy)
public java.lang.String nextName(java.lang.String baseName)
baseName
-
public void setGenerator(java.lang.Class type, Generator generator)
public void setSeed(long seed)
|
jDummy | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |