开发者

Stubbing web services to test clients using JUnit

开发者 https://www.devze.com 2023-03-27 23:15 出处:网络
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 u

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号