public void translate() throws Exception {
   String url = translateURL + "&lang=" + from + "-" + to + "&text=" + text;
   String response = getResponse(url);
   JSONObject json = new JSONObject(response);
   JSONArray jsonArray = json.getJSONArray("text");
   result = jsonArray.getString(0);
 }
Exemplo n.º 2
0
  @Ignore
  public void testSetMember() throws Exception {
    final String Path = "/members";
    ClientRequest webResource = new ClientRequest(BASE_URI + Path);

    ClientResponse response = null;

    JSONObject json_data = new JSONObject();
    json_data.put("name", "Jose Osuna");
    json_data.put("email", "*****@*****.**");
    json_data.put("phoneNumber", "04149367375");

    System.out.println(json_data);

    ClientRequest resource = webResource;
    resource.formParameter("auth_token", AUTH_TOKEN).formParameter("member", json_data);

    response = resource.post(ClientResponse.class);

    assertTrue(response.getStatus() == HTTP_STATUS_CREATED);
  }
Exemplo n.º 3
0
 public String getAttr() {
   return attr.toString();
 }