wood burning stoves
The moose likes Testing and the fly likes JMock and Web Service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "JMock and Web Service" Watch "JMock and Web Service" New topic

JMock and Web Service

Giovanni Esposito

Joined: Jul 10, 2013
Posts: 1
I am new with Jmock and I have a test case with Web Services that is implemented like i described ahead, however i can't inyect the mock of WebServiceContext and i dont know how i can do that.

Can anybody give me a hand with this... Thank in advance

Marshall Blythe
Ranch Hand

Joined: Feb 26, 2013
Posts: 35
You could add a setter method to your WebServiceBean to allow injection of a WebServiceContext and move the @Resource annotation to this method:

Now you can use JMock to create a mock WebServiceContext and inject it via the setter method.
subject: JMock and Web Service
It's not a secret anymore!