How to test a Jersey REST web service?

前端 未结 3 1924
独厮守ぢ
独厮守ぢ 2020-11-30 05:21

I have written a Restful Web service and have to test it using JUnit4. I have already written a Client using Jersey Client. But want to know if I can test my service only wi

3条回答
  •  北荒
    北荒 (楼主)
    2020-11-30 05:45

    I think @peeskillet has given you the needed prerequisites, i.e you need to run your web-service in an embedded web server. You could also look into dropwizard or spring-boot support for doing this conveniently.

    As for actually verifying the response I would keep it simple and go with JUnit & http-matchers (see https://github.com/valid4j/http-matchers)

提交回复
热议问题