|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
com.agical.rmock.extension.junit.AbstractStrategyTestCase
com.agical.rmock.extension.junit.BasicJUnitStrategyTestCase
com.agical.rmock.extension.junit.AbstractMockStrategyTestCase
com.agical.rmock.extension.junit.RMockTestCase
public abstract class RMockTestCase
(c) Agical AB 2005
Field Summary | |
---|---|
protected IteratorFactory |
all
|
protected DocumentationControl |
doc
|
protected MultiplicityFactory |
expect
|
protected MatchActionFactory |
matchAction
|
protected SectionFactory |
s
|
Fields inherited from class com.agical.rmock.extension.junit.AbstractStrategyTestCase |
---|
is |
Constructor Summary | |
---|---|
|
RMockTestCase()
|
protected |
RMockTestCase(Hub hub,
java.lang.String name)
|
protected |
RMockTestCase(java.lang.String name)
|
Method Summary | |
---|---|
void |
appendToSection(java.lang.String id)
|
void |
beginSection(Section section)
|
protected TestStep |
createStrategy(java.lang.String test)
Implement this method to return a strategy to run for the given test. |
protected void |
endSection()
|
void |
expectThatExceptionThrown(Expression exceptionExpression)
Sets up that an exception is expected to be thrown as a result of this testCase. |
protected java.lang.Object |
fakeAndIntercept(java.lang.Class itf)
Fake and intercept is meant to be used on interfaces. |
protected java.lang.Object |
fakeAndIntercept(java.lang.Class itf,
java.lang.String id)
Fake and intercept is meant to be used on interfaces. |
protected CollectionSelector |
forEach(Expression expression)
|
protected ExceptionVerifier |
getExceptionVerifier()
|
protected java.lang.Object |
intercept(java.lang.Class clazz)
intercept creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. |
protected java.lang.Object |
intercept(java.lang.Class clazz,
java.lang.Class[] signature,
java.lang.Object[] arguments)
intercept creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. |
protected java.lang.Object |
intercept(java.lang.Class clazz,
java.lang.Class[] signature,
java.lang.Object[] arguments,
java.lang.String id)
intercept creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. |
protected java.lang.Object |
intercept(java.lang.Class clazz,
java.lang.Object[] arguments)
intercept creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. |
protected java.lang.Object |
intercept(java.lang.Class clazz,
java.lang.Object[] arguments,
java.lang.String id)
intercept creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. |
protected java.lang.Object |
intercept(java.lang.Class clazz,
java.lang.String id)
intercept creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. |
protected java.lang.Object |
mock(java.lang.Class clazz)
Creates a mock for the selected class. |
protected java.lang.Object |
mock(java.lang.Class clazz,
java.lang.Class[] signature,
java.lang.Object[] args,
java.lang.String id)
Creates a mock for the selected class with the specified id , using
the specified args using the constructor with the specified signature . |
protected java.lang.Object |
mock(java.lang.Class clazz,
java.lang.Object[] args,
java.lang.String id)
Creates a mock for the selected class with the specified id , using
the specified args . |
protected java.lang.Object |
mock(java.lang.Class clazz,
java.lang.String id)
Creates a mock for the selected class with the specified id. |
MultiplicityModifier |
modify()
|
protected java.lang.Object |
monitor(java.lang.Class clazz)
Use this method to create monitored objects to trace in documentation. |
protected java.lang.Object |
monitor(java.lang.Class clazz,
java.lang.Class[] parameterTypes,
java.lang.Object[] arguments,
java.lang.String id)
Use this method to create monitored objects to trace in documentation. |
protected java.lang.Object |
monitor(java.lang.Class clazz,
java.lang.Object[] arguments,
java.lang.String id)
Use this method to create monitored objects to trace in documentation. |
protected java.lang.Object |
monitor(java.lang.Class clazz,
java.lang.String id)
Use this method to create monitored objects to trace in documentation. |
protected java.lang.Object |
monitor(java.lang.Object object,
java.lang.String id)
This method is for enabling simpler monitoring setup for e.g. |
void |
replaceSection(java.lang.String id,
Section section)
|
void |
setExceptionVerifier(ExceptionVerifier exceptionVerifier)
|
void |
setMultiplicityModifier(MultiplicityModifier multiplicityModifier)
|
void |
setSectionManager(SectionManager sectionManager)
|
void |
startVerification()
Change state of the mocks to start verify the recorded calls. |
protected java.lang.Object |
stub(java.lang.Class clazz,
java.lang.Class[] signature,
java.lang.Object[] arguments,
java.lang.String id)
Deprecated. use intercept instead |
protected java.lang.Object |
stub(java.lang.Class clazz,
java.lang.Object[] arguments,
java.lang.String id)
Deprecated. use intercept instead |
protected java.lang.Object |
stub(java.lang.Class clazz,
java.lang.String id)
Deprecated. use intercept instead |
Methods inherited from class com.agical.rmock.extension.junit.AbstractMockStrategyTestCase |
---|
createVerifyStep, exceptionVerifierDecorator, getProxyFactory, setProxyFactory, verify |
Methods inherited from class com.agical.rmock.extension.junit.BasicJUnitStrategyTestCase |
---|
createSetupStep, createTearDownStep, createTestStep, setUp, tearDown |
Methods inherited from class com.agical.rmock.extension.junit.AbstractStrategyTestCase |
---|
assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, getHub, getStrategyRunner, getVerifiable, runBare, setAsserter, setStrategyRunner, setTestCaseListener, setVerifiable |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runTest, setName, 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, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final SectionFactory s
protected final MultiplicityFactory expect
protected final IteratorFactory all
protected MatchActionFactory matchAction
protected DocumentationControl doc
Constructor Detail |
---|
public RMockTestCase()
protected RMockTestCase(java.lang.String name)
protected RMockTestCase(Hub hub, java.lang.String name)
Method Detail |
---|
protected TestStep createStrategy(java.lang.String test)
AbstractStrategyTestCase
createStrategy
in class AbstractMockStrategyTestCase
test
- The test to get the strategy for
public void setMultiplicityModifier(MultiplicityModifier multiplicityModifier)
protected java.lang.Object mock(java.lang.Class clazz)
ForwardAction
will forward calls
to that instance. By default the ReturnsAction
will be used (just as for mocked interfaces).
clazz
- The interface or object to implement for the mock
protected java.lang.Object mock(java.lang.Class clazz, java.lang.String id)
clazz
represents an object the class MUST be non-final and it MUST
have a default constructor.
The mocked object is created in the background. The ForwardAction
will forward calls
to that instance. By default the ReturnsAction
will be used (just as for mocked interfaces).
clazz
- The interface or object to implement for the mockid
- the name of the recorder
protected java.lang.Object mock(java.lang.Class clazz, java.lang.Object[] args, java.lang.String id)
id
, using
the specified args
.
The id MUST be unique within the testmethod
The class MUST be non-final and it MUST
have a only one constructor signature assignable from the provided args
.
The mocked object is created in the background. The ForwardAction
will forward calls
to that instance. By default the ReturnsAction
will be used (just as for mocked interfaces).
clazz
- The object to implement for the mockargs
- The arguments to the constructorid
- the name of the recorder
protected java.lang.Object mock(java.lang.Class clazz, java.lang.Class[] signature, java.lang.Object[] args, java.lang.String id)
id
, using
the specified args
using the constructor with the specified signature
.
The mocked object is created in the background. The ForwardAction
will forward calls
to that instance. By default the ReturnsAction
will be used (just as for mocked interfaces).
The id MUST be unique within the testmethod
The class MUST be non-final and it MUST
of course have a constructor with the provided signature
that can accept the provided args
.
clazz
- The object to implement for the mocksignature
- The signature for the constructor to useargs
- The arguments to the constructorid
- the name of the recorder
protected java.lang.Object intercept(java.lang.Class clazz)
intercept
creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. If restrictions should be made on the intercepted object, those can
be made just as with a mock.
clazz
- The type to implement for the intercepted object
protected java.lang.Object intercept(java.lang.Class clazz, java.lang.String id)
intercept
creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. If restrictions should be made on the intercepted object, those can
be made just as with a mock.
clazz
- The type to implement for the intercepted objectid
- the name of the intercepted object
protected java.lang.Object intercept(java.lang.Class clazz, java.lang.Class[] signature, java.lang.Object[] arguments, java.lang.String id)
intercept
creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. If restrictions should be made on the intercepted object, those can
be made just as with a mock.
The id MUST be unique within the testmethod
The class MUST be non-final and it MUST
of course have a constructor with the provided signature
that can accept the provided args
.
clazz
- The type to implement for the intercepted objectsignature
- The signature for the constructor to useargs
- The arguments to the constructorid
- the name of the intercepted object
protected java.lang.Object intercept(java.lang.Class clazz, java.lang.Class[] signature, java.lang.Object[] arguments)
intercept
creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. If restrictions should be made on the intercepted object, those can
be made just as with a mock.
signature
that can accept the provided args
.
clazz
- The type to implement for the intercepted objectsignature
- The signature for the constructor to useargs
- The arguments to the constructor
protected java.lang.Object intercept(java.lang.Class clazz, java.lang.Object[] arguments, java.lang.String id)
intercept
creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. If restrictions should be made on the intercepted object, those can
be made just as with a mock.
args
.
clazz
- The type to implement for the intercepted objectargs
- The arguments to the constructorid
- the name of the intercepted object
protected java.lang.Object intercept(java.lang.Class clazz, java.lang.Object[] arguments)
intercept
creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. If restrictions should be made on the intercepted object, those can
be made just as with a mock.
args
.
clazz
- The type to implement for the intercepted objectargs
- The arguments to the constructor
protected java.lang.Object stub(java.lang.Class clazz, java.lang.String id)
stub
creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. If restrictions should be made on the stub, those can
be made just as with a mock.
clazz
- The type to implement for the stubid
- the name of the intercepted object
protected java.lang.Object stub(java.lang.Class clazz, java.lang.Class[] signature, java.lang.Object[] arguments, java.lang.String id)
stub
creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. If restrictions should be made on the stub, those can
be made just as with a mock.
The id MUST be unique within the testmethod
The class MUST be non-final and it MUST
of course have a constructor with the provided signature
that can accept the provided args
.
clazz
- The object to implement for the stubsignature
- The signature for the constructor to useargs
- The arguments to the constructorid
- the name of the stub
protected java.lang.Object stub(java.lang.Class clazz, java.lang.Object[] arguments, java.lang.String id)
stub
creates an instance of the specified class (just as mock for a class), but
it forwards all calls to that instance. If restrictions should be made on the stub, those can
be made just as with a mock.
args
.
clazz
- The object to implement for the stubargs
- The arguments to the constructorid
- the name of the stub
protected java.lang.Object fakeAndIntercept(java.lang.Class itf, java.lang.String id)
itf
- The interface to fake and interceptid
- The identifier for the resulting proxy
protected java.lang.Object fakeAndIntercept(java.lang.Class itf)
itf
- The interface to fake and intercept
public void startVerification()
protected java.lang.Object monitor(java.lang.Object object, java.lang.String id)
object
- id
-
protected java.lang.Object monitor(java.lang.Class clazz, java.lang.String id)
clazz
- The class to createid
- The name of the object for presentation purposes
protected java.lang.Object monitor(java.lang.Class clazz)
clazz
- The class to create
protected java.lang.Object monitor(java.lang.Class clazz, java.lang.Object[] arguments, java.lang.String id)
clazz
- The class to createarguments
- An object array to initialize an instance of class withid
- The name of the object for presentation purposes
protected java.lang.Object monitor(java.lang.Class clazz, java.lang.Class[] parameterTypes, java.lang.Object[] arguments, java.lang.String id)
clazz
- The class to createparameterTypes
- The signature to create the object witharguments
- The arguments to create the object withid
- The name of the object for presentation purposes
public MultiplicityModifier modify()
public void expectThatExceptionThrown(Expression exceptionExpression)
expression
- The expression to match the exception typeprotected void endSection()
public void beginSection(Section section)
protected CollectionSelector forEach(Expression expression)
public void setSectionManager(SectionManager sectionManager)
protected ExceptionVerifier getExceptionVerifier()
public void setExceptionVerifier(ExceptionVerifier exceptionVerifier)
public void replaceSection(java.lang.String id, Section section)
public void appendToSection(java.lang.String id)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |