/**
  * Delete records specified in idToNames
  *
  * @param ids
  * @throws Exception
  */
 protected void deleteRecordsOnServer(Set<String> ids, String objectType) throws Exception {
   for (String id : ids) {
     RestRequest request =
         RestRequest.getRequestForDelete(
             ApiVersionStrings.getVersionNumber(targetContext), objectType, id);
     restClient.sendSync(request);
   }
 }
  /**
   * Helper methods to create "count" of test records
   *
   * @param count
   * @return map of id to name for the created accounts
   * @throws Exception
   */
  protected Map<String, String> createRecordsOnServer(int count, String objectType)
      throws Exception {
    Map<String, String> idToValues = new HashMap<String, String>();
    for (int i = 0; i < count; i++) {

      // Request.
      String fieldValue = createRecordName(objectType);
      Map<String, Object> fields = new HashMap<String, Object>();
      // add more object type if need to support to use this API
      // to create a new record on server
      switch (objectType) {
        case Constants.ACCOUNT:
          fields.put(Constants.NAME, fieldValue);
          break;
        case Constants.OPPORTUNITY:
          fields.put(Constants.NAME, fieldValue);
          fields.put("StageName", "Prospecting");
          DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
          fields.put("CloseDate", formatter.format(new Date()));
          break;
        default:
          break;
      }

      RestRequest request =
          RestRequest.getRequestForCreate(
              ApiVersionStrings.getVersionNumber(targetContext), objectType, fields);

      // Response.
      RestResponse response = restClient.sendSync(request);
      assertNotNull("Response should not be null", response);
      assertTrue("Response status should be success", response.isSuccess());
      String id = response.asJSONObject().getString(LID);
      idToValues.put(id, fieldValue);
    }
    return idToValues;
  }