### Question:
ParseRESTCommand extends ParseRequest<JSONObject> { public String getCacheKey() { String json; if (jsonParameters != null) { try { json = toDeterministicString(jsonParameters); } catch (JSONException e) { throw new RuntimeException(e.getMessage()); } } else { json = ""; } if (sessionToken != null) { json += sessionToken; } return String.format( "ParseRESTCommand.%s.%s.%s", method.toString(), ParseDigestUtils.md5(httpPath), ParseDigestUtils.md5(json) ); } ParseRESTCommand(
      String httpPath,
      ParseHttpRequest.Method httpMethod,
      Map<String, ?> parameters,
      String sessionToken);  ParseRESTCommand(
      String httpPath,
      ParseHttpRequest.Method httpMethod,
      JSONObject jsonParameters,
      String sessionToken); private  ParseRESTCommand(
      String httpPath,
      ParseHttpRequest.Method httpMethod,
      JSONObject jsonParameters,
      String localId, String sessionToken);   ParseRESTCommand(Init<?> builder); static ParseRESTCommand fromJSONObject(JSONObject jsonObject); @Override Task<JSONObject> executeAsync(
      final ParseHttpClient client,
      final ProgressCallback uploadProgressCallback,
      final ProgressCallback downloadProgressCallback,
      final Task<Void> cancellationToken); String getCacheKey(); JSONObject toJSONObject(); String getSessionToken(); String getOperationSetUUID(); void setLocalId(String localId); String getLocalId(); void resolveLocalIds(); void retainLocalIds(); void releaseLocalIds(); public String masterKey; }### Answer:
@Test public void testGetCacheKey() throws Exception { String httpPath = "www.parse.com"; JSONObject jsonParameters = new JSONObject() .put("count", 1) .put("limit", 1); String sessionToken = "sessionToken"; String localId = "localId"; ParseRESTCommand command = new ParseRESTCommand.Builder() .httpPath(httpPath) .jsonParameters(jsonParameters) .method(ParseHttpRequest.Method.POST) .sessionToken(sessionToken) .localId(localId) .build(); String cacheKey = command.getCacheKey(); assertTrue(cacheKey.contains("ParseRESTCommand")); assertTrue(cacheKey.contains(ParseHttpRequest.Method.POST.toString())); assertTrue(cacheKey.contains(ParseDigestUtils.md5(httpPath))); String str = ParseDigestUtils.md5(ParseRESTCommand.toDeterministicString(jsonParameters) + sessionToken); assertTrue(cacheKey.contains(str)); }
@Test public void testGetCacheKeyWithNoJSONParameters() throws Exception { String httpPath = "www.parse.com"; String sessionToken = "sessionToken"; String localId = "localId"; ParseRESTCommand command = new ParseRESTCommand.Builder() .httpPath(httpPath) .method(ParseHttpRequest.Method.POST) .sessionToken(sessionToken) .localId(localId) .build(); String cacheKey = command.getCacheKey(); assertTrue(cacheKey.contains("ParseRESTCommand")); assertTrue(cacheKey.contains(ParseHttpRequest.Method.POST.toString())); assertTrue(cacheKey.contains(ParseDigestUtils.md5(httpPath))); assertTrue(cacheKey.contains(ParseDigestUtils.md5(sessionToken))); }