File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
Greenhorn

Joined: Feb 26, 2013
Posts: 27
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JMock and Web Service
 
Similar Threads
Extracting username from soapheader
Print Client IP
Retrieve Soap header
How to get Session context in RESTFul services
WebServiceContext or handle to session in CXF JAX-RS implementation