【发布时间】:2013-07-12 17:44:51
【问题描述】:
我使用 Jersey,并且我有以下 Rest 函数,它在部署我的服务器时返回一个 JSON 字符串:
@GET
@Path("getallemployees")
@Produces("application/json")
public Response getAllEmployees() {
//building the entity object which is List<Employee>
return Response.ok(entity).build();
}
我需要开发一些单元测试(不是集成测试),我想以某种方式模拟调用此方法的 HTTPRequest,然后获取 json 字符串。最好的选择是为此使用 mockito。
有什么建议吗?
谢谢!!
【问题讨论】:
标签: json junit jersey httprequest mockito