2014-02-20 3 views

답변

2

예, Jersey-Test-Framework를 사용할 수 있습니다.

당신은 여기에서 예를 찾을 수 있습니다 당신은 또한 REST는 피보험자 사용할 수 있습니다

http://www.hascode.com/2011/09/rest-assured-vs-jersey-test-framework-testing-your-restful-web-services/

. 여기에 예를

http://www.hascode.com/2011/10/testing-restful-web-services-made-easy-using-the-rest-assured-framework/

+0

정말 도움이되었습니다. 감사합니다 – nagendra

+0

도움이되기를 기원합니다.) 도움이 되었다면 대답을 수락하십시오. – TheEwook

0

하면 아파치 HttpClient를을 라이브러리를 사용하여 나머지 API를 테스트 할 수있다. Java 코드 예는 아래와 같습니다.

  String uri = "http://localhost:7001/myapis/search/json"; 
      URIBuilder uriBuilder = new URIBuilder(uri); 
      uriBuilder.addParameter("institutionName", "HSBC%"); 
      uriBuilder.addParameter("isoCountryCode", "GB"); 

      HttpGet httpGet = new HttpGet(uriBuilder.build()); 
      HttpClient httpClient = new DefaultHttpClient(); 
      HttpResponse httpResponse = httpClient.execute(httpGet); 
      HttpEntity httpEntity = httpResponse.getEntity(); 
      String result = EntityUtils.toString(httpEntity);