我是单元测试新手,我想在一个项目中测试一些jersey服务.我们正在使用Junit.请指导我以更好的方式编写测试用例.
CODE:个
@GET
@Path("/getProducts/{companyID}/{companyName}/{date}")
@Produces(MediaType.APPLICATION_JSON)
public Object getProducts(@PathParam("companyID") final int companyID,
@PathParam("date") final String date, @PathParam("companyName") final String companyName)
throws IOException {
return productService.getProducts(companyID, companyName, date);
}
Above mentioned service is working fine and I want to write junit test case to test above mentioned method. Above method will retrieve list of products (List<Product>
) in JSON format. I would like to write test case to check response status and json format.
NOTE: We are using Jersey 1.17.1 version.
Help would be appreciated :)