Anyone have an example of using Mockito within your Nuxeo code?

I have a listener class which includes this code:

GatewayClient gatewayClient = Framework.getService(GatewayClient.class);

I want to write a junit which will invoke the listener class, and I want to mock the call to the gateway.

My first problem is I don't understand how to mock a class, which is being created inside the class I am testing.

The second problem is that I don't know if the Framwork.getService call will get in the way of the attempt to mock.

0 votes

0 answers

92 views

ANSWER

I found this, which includes Mockito. Don't understand it yet, so not sure it this gives me what I want. https://doc.nuxeo.com/corg/unit-testing/
05/25/2022