user4903
user4903

Reputation:

What is the best way to write a JUnit test against a method signature that calls a Web service?

The method I want to test has a local variable that references an object returned from a Web service call. This Web service returns information specific to a particular user based upon input from that user on a Web page. It is like a question/answer, where the answer given in a form text field must match the answer provided by the user at an earlier date, and is now tied from their account. There are certain things that happen based upon whether or not they got the answer correct. Should I mock out the service as a field on the class instead, where I can set it to return a dummy service response, or is there a better way to test it? Thanks!

Upvotes: 2

Views: 308

Answers (1)

Paul Sonier
Paul Sonier

Reputation: 39510

I think your intuition is good on this one, to mock out the service.

Upvotes: 5

Related Questions