Stubbing web services to test clients using JUnit
I have some JAX-WS-based web service clients and I'd like to write some JUnit test cases for them.
In my mind, this means stubbing the endpoints. I want this all to be embedded in my test code, not using a third-party stub application like soapUI. Some things I've heard of that m开发者_运维知识库ight work are:
- WSUnit -- However, it seems like it's no longer an active project (notice the broken link)
- Embedding Jetty and expose a static resource web server to respond to the web service requests
What's the easiest way to do this?
UPDATE: I ended up using Jetty embedded and writing my own handler because I couldn't quickly figure out how to serve POST requests and set the content-type using Jetty's ResourceHandler
. It was a quick and easy solution, but if there's something even better it would be good to know.
精彩评论