JsonHttpUtil { public static <RESPONSE_T> RESPONSE_T getCollection(String url, TypeReference<RESPONSE_T> typeReference) throws Exception { String responseStr = HttpUtil.get(url); return JsonUtil.toCollectionBean(responseStr, typeReference); }  static RESPONSE_T postOne(String url, REQUEST_T requestBodyObject, Class<RESPONSE_T> responseType); static RESPONSE_T postOne(String url, Class<RESPONSE_T> responseType); static RESPONSE_T postCollection(String url, REQUEST_T requestBodyObject, TypeReference<RESPONSE_T> typeReference); static RESPONSE_T postCollection(String url, TypeReference<RESPONSE_T> typeReference); static RESPONSE_T getOne(String url, Class<RESPONSE_T> responseType); static RESPONSE_T getCollection(String url, TypeReference<RESPONSE_T> typeReference);  }
@Test public void testGetCollection() throws Exception { String url = buildUrl("getList"); List<User> userList = JsonHttpUtil.getCollection(url, new TypeReference<List<User>>() { }); Assert.hasLength(userList.get(0).getName()); }