Unit Testing Challenges

Hi All,

Currently I am facing challenges in unit testing of zeebe handler’s handle method. handle method take two parameter JobClinet and ActivateJob.
I am using mockito to mock JobClient

client.newCompleteCommand(job.getKey()).variables(responseMap).send().join();

Mocking is not possible beyond newCompleteCommand().It returned null in spite of mocking
CompleteJobCommandStep1 which is internal to ZeeBe worker.

Is there any way we can mock , any help in this regard will be appreciated.

Hi @sandeepsingh,

it is also possible to mock fluent APIs. Please have a look at: https://maciejwalkowiak.com/mocking-fluent-interfaces/

Integration tests can be written using the test module - see https://docs.zeebe.io/java-client/testing.html

Does this help you?

Best regards,
Philipp