public abstract class RMockTestCase extends AbstractMockStrategyTestCase
Modifier and Type | Field and Description |
---|---|
protected IteratorFactory |
all |
protected DocumentationControl |
doc |
protected MultiplicityFactory |
expect |
protected MatchActionFactory |
matchAction |
protected SectionFactory |
s |
is
Modifier | Constructor and Description |
---|---|
|
RMockTestCase() |
protected |
RMockTestCase(Hub hub,
String name) |
protected |
RMockTestCase(String name) |
Modifier and Type | Method and Description |
---|---|
void |
appendToSection(String id) |
void |
beginSection(Section section) |
protected TestStep |
createStrategy(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 Object |
fakeAndIntercept(Class itf)
Fake and intercept is meant to be used on interfaces.
|
protected Object |
fakeAndIntercept(Class itf,
String id)
Fake and intercept is meant to be used on interfaces.
|
protected CollectionSelector |
forEach(Expression expression) |
protected ExceptionVerifier |
getExceptionVerifier() |
protected Object |
intercept(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 Object |
intercept(Class clazz,
Class[] signature,
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 Object |
intercept(Class clazz,
Class[] signature,
Object[] arguments,
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 Object |
intercept(Class clazz,
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 Object |
intercept(Class clazz,
Object[] arguments,
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 Object |
intercept(Class clazz,
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 Object |
mock(Class clazz)
Creates a mock for the selected class.
|
protected Object |
mock(Class clazz,
Class[] signature,
Object[] args,
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 Object |
mock(Class clazz,
Object[] args,
String id)
Creates a mock for the selected class with the specified
id , using
the specified args . |
protected Object |
mock(Class clazz,
String id)
Creates a mock for the selected class with the specified id.
|
MultiplicityModifier |
modify() |
protected Object |
monitor(Class clazz)
Use this method to create monitored objects to trace in documentation.
|
protected Object |
monitor(Class clazz,
Class[] parameterTypes,
Object[] arguments,
String id)
Use this method to create monitored objects to trace in documentation.
|
protected Object |
monitor(Class clazz,
Object[] arguments,
String id)
Use this method to create monitored objects to trace in documentation.
|
protected Object |
monitor(Class clazz,
String id)
Use this method to create monitored objects to trace in documentation.
|
protected Object |
monitor(Object object,
String id)
This method is for enabling simpler monitoring setup for e.g.
|
void |
replaceSection(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 Object |
stub(Class clazz,
Class[] signature,
Object[] arguments,
String id)
Deprecated.
use intercept instead
|
protected Object |
stub(Class clazz,
Object[] arguments,
String id)
Deprecated.
use intercept instead
|
protected Object |
stub(Class clazz,
String id)
Deprecated.
use intercept instead
|
createVerifyStep, exceptionVerifierDecorator, getProxyFactory, setProxyFactory, verify
createSetupStep, createTearDownStep, createTestStep, setUp, tearDown
assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, getHub, getStrategyRunner, getVerifiable, runBare, setAsserter, setStrategyRunner, setTestCaseListener, setVerifiable
countTestCases, createResult, getName, run, run, runTest, setName, toString
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
protected final SectionFactory s
protected final MultiplicityFactory expect
protected final IteratorFactory all
protected MatchActionFactory matchAction
protected DocumentationControl doc
public RMockTestCase()
protected RMockTestCase(String name)
protected TestStep createStrategy(String test)
AbstractStrategyTestCase
createStrategy
in class AbstractMockStrategyTestCase
test
- The test to get the strategy forpublic void setMultiplicityModifier(MultiplicityModifier multiplicityModifier)
protected Object mock(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 mockprotected Object mock(Class clazz, 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 recorderprotected Object mock(Class clazz, Object[] args, 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 recorderprotected Object mock(Class clazz, Class[] signature, Object[] args, 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 recorderprotected Object intercept(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 objectprotected Object intercept(Class clazz, 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 objectprotected Object intercept(Class clazz, Class[] signature, Object[] arguments, 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 objectprotected Object intercept(Class clazz, Class[] signature, 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 constructorprotected Object intercept(Class clazz, Object[] arguments, 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 objectprotected Object intercept(Class clazz, 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 constructorprotected Object stub(Class clazz, 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 objectprotected Object stub(Class clazz, Class[] signature, Object[] arguments, 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 stubprotected Object stub(Class clazz, Object[] arguments, 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 stubprotected Object fakeAndIntercept(Class itf, String id)
itf
- The interface to fake and interceptid
- The identifier for the resulting proxyprotected Object fakeAndIntercept(Class itf)
itf
- The interface to fake and interceptpublic void startVerification()
protected Object monitor(Object object, String id)
object
- id
- protected Object monitor(Class clazz, String id)
clazz
- The class to createid
- The name of the object for presentation purposesprotected Object monitor(Class clazz)
clazz
- The class to createprotected Object monitor(Class clazz, Object[] arguments, String id)
clazz
- The class to createarguments
- An object array to initialize an instance of class withid
- The name of the object for presentation purposesprotected Object monitor(Class clazz, Class[] parameterTypes, Object[] arguments, 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 purposespublic 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 appendToSection(String id)
Copyright © 2005-2013 Agical AB. All Rights Reserved.