mardi 21 juin 2016

How to test(mock) object that uses external API (Jama Software)

I encountered a problem while trying to test Class, which uses external API -

Jama Software

. Let's say there is a ClassA. It has 2 methods,that I want to test using JUnit. Both methods have ClassB as an argument.

ClassB is belonging to another API. I can see it's methods but the implementation details are not available.(compiled code). The question is: How can I mock this classes to make TestClass isolated? I know that in Mockito there is an option to hardcode responses. Is there any better/cleaner way of doing this, so I don't need to manually configure mock objects? I would be grateful for any advices on that topic.

Aucun commentaire:

Enregistrer un commentaire