Java Rersteasy例外情况“;没有用于提取实体的类型信息,请使用其他getEntity()方法;

Java Rersteasy例外情况“;没有用于提取实体的类型信息,请使用其他getEntity()方法;,java,junit,resteasy,Java,Junit,Resteasy,我正在我的项目中使用resteasy。我正在从rest webfunction返回一个响应对象 @Override public Response getData(@QueryParam(value = "test") String test) { GenericEntity<List<UserEntity>> customerentities = new GenericEntity<List<UserEntity>>(result){};

我正在我的项目中使用resteasy。我正在从rest webfunction返回一个响应对象

@Override
public Response getData(@QueryParam(value = "test") String test) {
   GenericEntity<List<UserEntity>> customerentities = new  GenericEntity<List<UserEntity>>(result){};//  result is the List<UserEntity>
    return Response.ok(customerentities).build();
}
@覆盖
公共响应getData(@QueryParam(value=“test”)字符串测试){
GenericeEntity customerentities=新的GenericeEntity(结果){};//结果是列表
返回Response.ok(customerenties.build();
}
现在在我的junit测试用例中,我正在做

Response response = testService.getData("testD");
response.getEntity() // doing this to retrive the List<UserEntity>
Response-Response=testService.getData(“testD”);
response.getEntity()//执行此操作以检索列表
但是得到下面的错误

java.lang.RuntimeException:没有用于提取实体的类型信息,请使用其他getEntity()方法 位于org.jboss.resteasy.client.core.BaseClientResponse.getEntity(BaseClientResponse.java:334)


有什么想法吗?

在Resteasy客户端上使用
getEntity()
方法时,需要通过
参数指定类型,否则需要调用其他重载的
getEntity()
方法之一,这些方法在方法签名中指定预期的返回类型

   ClientRequest request = new ClientRequest('RESOURCE URL HERE');
   ClientResponse<List<UserEntity>> response = request.get(new GenericType<List<UserEntity>>(){});
   List<UserEntity> users = response.getEntity();
ClientRequest=newclientrequest('resourceurlhere');
ClientResponse response=request.get(新的GenericType(){});
List users=response.getEntity();