No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Imixs-Mock is a testing library for mocking the Imixs Workflow engine.

Mocking is primarily used in unit testing. An object under test may have dependencies on other (complex) objects. To isolate the behavior of the object you want to replace the other objects by mocks that simulate the behavior of the real objects. This is useful if the real objects are impractical to incorporate into the unit test.

In short, mocking is creating objects that simulate the behavior of real objects.

How to Use

To use the library in your own project just add the following maven dependencies:

<!-- JUnit Tests -->

Junit Tests

In a JUnit Test class you can initialize the Imixs-Workflow Mock environment:

public class TestMyWorkflow {
	WorkflowMockEnvironment workflowMockEnvironment;

	final static String MODEL_PATH = "/mymodel.bpmn";
	final static String MODEL_VERSION = "1.0.0";

	ItemCollection workitem = null;

	// setup the workflow envirnment
	public void setup() throws PluginException, ModelException {

		// initialize @Mock annotations....

		workflowMockEnvironment = new WorkflowMockEnvironment();

		// test model...

You can find a full example of a jUnit Test here

Test Your Model

After you have setup the workflow Mock you can write test methods to test specific model situations. In your test method you simulate a Task and an Event in the following way:

public void testSimple() {

	workitem = new ItemCollection();
	workitem.replaceItemValue("_subject", "Hello World");

	try {
		workitem = workflowMockEnvironment.getWorkflowService().processWorkItem(workitem);
	} catch (AccessDeniedException | ProcessingErrorException | PluginException | ModelException e) {;


Test only specific Plugins

You can overwrite the plug-in list defined by your model to test only specific plug-ins. This can be useful to reduce the complexity in a mock environment

// test only specific Plugins.....
try {
			.addModel(new ModelPluginMock(workflowMockEnvironment.getModel(),
} catch (ModelException e) {

Simulate User Login

You can easily simulate a specific user in you test class by

Principal principal = Mockito.mock(Principal.class);

Set Log Level

To set the log level in a unit test you can simply change the standard logger: