dimanche 31 janvier 2016

How to mock a builder using JMockit

I need to mock a builder. Lets say: UriComponentsBuilder; I need to mock the static method: fromHttpUrl to return a mocked instance of itself, so that the other methods likes queryParam or build can be handled.

If I mark the instance to be returned from fromHttpUrl as @Injectable, it keeps throwing "Class already mocked".

How can I achieve this?

Aucun commentaire:

Enregistrer un commentaire