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.