JsonHttpUtil { public static <RESPONSE_T> RESPONSE_T getOne(String url, Class<RESPONSE_T> responseType) throws Exception { String responseStr = HttpUtil.get(url); return JsonUtil.toBean(responseStr, responseType); }  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 testGet() throws Exception { String url = buildUrl("getOne"); User user = JsonHttpUtil.getOne(url, User.class); Assert.hasLength(user.getName()); }