Package ch.ivyteam.ivy.bpm.engine.client
Interface Mocker
public interface Mocker
Mocks process elements for testing. Use it to mock UI elements or elements that communicate with external systems like databases, SOAP and REST web services, etc.
Example how to mock an HTML Dialog:
BpmElement HTML_DIALOG = BpmProcess.name("ProcurementRequest").elementName("Registration Form");
bpmClient.mock().element(HTML_DIALOG).with(ProcurementRequest.class, (in, out) ->
{
out.setDescription("PC");
out.setPricePerUnit(877.99);
out.setAmount(1);
out.setNotes("My old PC broke down");
});
This mocks the whole element. If you want to only mock the UI part of an HTML Dialog so that the parameter mapping and the result mapping is executed and tested then have a look at the next example
Example how to mock the UI part of an HTML Dialog:
BpmElement HTML_DIALOG = BpmProcess.name("ProcurementRequest").elementName("Registration Form");
bpmClient.mock().uiOf(HTML_DIALOG).with((parameters, results) ->
{
ProcurementRequest data = new ProcurementRequest();
data.setDescription("PC");
data.setPricePerUnit(877.99);
data.setAmount(1);
data.setNotes("My old PC broke down");
results.set("procurementRequestData", data);
});
- Since:
- 9.1
- API:
- This is a public API.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Provides the input (in) and the output (out) variables so that a tester can map data from in to out and also setups new data on out.static interface
A mocked Call/UI operationstatic interface
static interface
Mocks the Call/UI part of an call or UI element -
Method Summary
Modifier and TypeMethodDescriptionelement
(BpmElement processElement) Mocks the given element.uiOf
(BpmElement uiElement) Mocks the UI part of the given UI element.
-
Method Details
-
element
Mocks the given element. This mocks the whole element. For some elements also only the Call/UI part of the element can be mocked. SeeuiOf(ch.ivyteam.ivy.bpm.engine.client.element.BpmElement)
,callOf(ch.ivyteam.ivy.bpm.engine.client.element.BpmElement)
- Parameters:
processElement
-- Returns:
- with
- See Also:
-
uiOf(BpmElement)
callOf(BpmElement)
- API:
- This public API is available in Java.
-
uiOf
Mocks the UI part of the given UI element. Currently only UserDialog and UserTask elements supports to mock the UI part.- Parameters:
uiElement
-- Returns:
- with
- Since:
- 9.2
- API:
- This public API is available in Java.
-