wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "JMock and Web Service" Watch "JMock and Web Service" New topic
Author

JMock and Web Service

Giovanni Esposito
Greenhorn

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: 32
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.
 
wood burning stoves
 
subject: JMock and Web Service
 
Similar Threads
How to get Session context in RESTFul services
Extracting username from soapheader
WebServiceContext or handle to session in CXF JAX-RS implementation
Retrieve Soap header
Print Client IP