Unit testing jersey Restful Services

后端 未结 3 673
故里飘歌
故里飘歌 2020-12-08 07:21

I\'m new to unit testing and I want to test some jersey services in a project. We are using Junit. Please guide me to write test cases in better way.

CODE:

3条回答
  •  囚心锁ツ
    2020-12-08 07:51

    Just ignore the annotations and write a normal unit test that passes the required parameters. The return I thought would usually be of type "javax.ws.rs.core.Response" ... There is a getEntity() method on that can be used. Using a Mock object framework like Mockito could be helpful in this case too.

提交回复
热议问题