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
Nested Classes Modifier and Type Interface Description static interface
Mocker.DataMapper<T>
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
Mocker.MockedCall
A mocked Call/UI operationstatic interface
Mocker.WithMock
static interface
Mocker.WithMockedCall
Mocks the Call/UI part of an call or UI element
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Mocker.WithMock
element(BpmElement processElement)
Mocks the given element.Mocker.WithMockedCall
uiOf(BpmElement uiElement)
Mocks the UI part of the given UI element.
-
-
-
Method Detail
-
element
Mocker.WithMock element(BpmElement processElement)
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
Mocker.WithMockedCall uiOf(BpmElement uiElement)
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.
-
-