| java.lang.Object | |
| ↳ | org.mule.munit.MockModule |
Known Direct Subclasses
|
Known Indirect Subclasses
|
Module for Mocking devkit Modules.
With this module you can mock using mockito framework all the modules that are written with Mule Devkit.
In order to be able to mock a module it has to be declare with a reference name. For example:
Otherwise the module/connector will not be accessible by a reference name and will not be able to be mocked.
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| connectionKeyClass | |||||||||||
| connectionManagerMock | |||||||||||
| mock | |||||||||||
| muleContext | |||||||||||
| of | Component that we want to mock. |
||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Define what the mock must return on a message processor call. | |||||||||||
Expect to throw an exception when message processor is called. | |||||||||||
Throw an Exception when a connector tries to connect.
| |||||||||||
Reset mock behaviour
| |||||||||||
Set The name of the bean to be mocked. | |||||||||||
Check that the message processor was called with some specified parameters
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.mule.api.context.MuleContextAware
| |||||||||||
From interface
org.springframework.beans.factory.config.BeanFactoryPostProcessor
| |||||||||||
Define what the mock must return on a message processor call.
If the message processor doesn't return any value then there is no need to define an expect.
You can define the message processor parameters in the same order they appear in the API documentation. In order to define the behaviour on that particular case.
| when | Message processor name. |
|---|---|
| parameters | Message processor parameters. |
| mustReturn | Expected return value. |
| mustReturnResponseFrom | The flow name that creates the expected result |
Expect to throw an exception when message processor is called.
| when | Message processor name. |
|---|---|
| throwA | Java Exception full qualified name. |
Throw an Exception when a connector tries to connect.
| beanFactory |
|---|
| BeansException |
|---|
Reset mock behaviour
| muleContext |
|---|
Set The name of the bean to be mocked.
| of | The name of the bean to be mocked |
|---|
Check that the message processor was called with some specified parameters
| messageProcessor | Message processor Id |
|---|---|
| parameters | Message processor parameters. |
| times | Number of times the message processor has to be called |
| atLeast | Number of time the message processor has to be called at least. |
| atMost | Number of times the message processor has to be called at most. |