Source:
public void getCallsListUsingSorting() { JsonObject response1 = RestcommCallsTool.getInstance().getCalls(deploymentUrl.toString(), adminAccountSid, adminAuthToken, 0, 10, "date_created:asc", true); assertTrue(((JsonObject)response1.get("calls").getAsJsonArray().get(0)).get("date_created").getAsString().equals("Fri, 5 Jul 2013 22:15:53 +0300")); JsonObject response2 = RestcommCallsTool.getInstance().getCalls(deploymentUrl.toString(), adminAccountSid, adminAuthToken, 0, 10, "date_created", true); assertTrue(((JsonObject)response2.get("calls").getAsJsonArray().get(0)).get("date_created").getAsString().equals("Tue, 31 May 2016 16:20:22 +0300")); JsonObject response3 = RestcommCallsTool.getInstance().getCalls(deploymentUrl.toString(), adminAccountSid, adminAuthToken, 0, 10, "date_created:desc", true); assertTrue(((JsonObject)response3.get("calls").getAsJsonArray().get(0)).get("date_created").getAsString().equals("Tue, 31 May 2016 16:20:22 +0300")); JsonObject response4 = RestcommCallsTool.getInstance().getCalls(deploymentUrl.toString(), adminAccountSid, adminAuthToken, 0, 10, null, true); assertTrue(((JsonObject)response4.get("calls").getAsJsonArray().get(0)).get("date_created").getAsString().equals("Tue, 31 May 2016 16:20:22 +0300")); try { RestcommCallsTool.getInstance().getCalls(deploymentUrl.toString(), adminAccountSid, adminAuthToken, 0, 10, ":asc", true); } catch (UniformInterfaceException e) { assertTrue(e.getResponse().getStatus() == BAD_REQUEST.getStatusCode()); } try { RestcommCallsTool.getInstance().getCalls(deploymentUrl.toString(), adminAccountSid, adminAuthToken, 0, 10, "start_time:invalid", true); } catch (UniformInterfaceException e) { assertTrue(e.getResponse().getStatus() == BAD_REQUEST.getStatusCode()); } }

Target:
public void getCallsListUsingSorting() { JsonObject response1 = RestcommCallsTool.getInstance().getCalls(deploymentUrl.toString(), adminAccountSid, adminAuthToken, 0, 10, "DateCreated:asc", true); assertEquals(((JsonObject)response1.get("calls").getAsJsonArray().get(0)).get("date_created").getAsString(), "Fri, 5 Jul 2013 22:15:53 +0300"); JsonObject response2 = RestcommCallsTool.getInstance().getCalls(deploymentUrl.toString(), adminAccountSid, adminAuthToken, 0, 10, "DateCreated", true); assertEquals(((JsonObject)response2.get("calls").getAsJsonArray().get(0)).get("date_created").getAsString(), "Fri, 5 Jul 2013 22:15:53 +0300"); JsonObject response3 = RestcommCallsTool.getInstance().getCalls(deploymentUrl.toString(), adminAccountSid, adminAuthToken, 0, 10, "DateCreated:desc", true); assertEquals(((JsonObject)response3.get("calls").getAsJsonArray().get(0)).get("date_created").getAsString(), "Tue, 31 May 2016 16:20:22 +0300"); try { RestcommCallsTool.getInstance().getCalls(deploymentUrl.toString(), adminAccountSid, adminAuthToken, 0, 10, ":asc", true); } catch (UniformInterfaceException e) { assertEquals(e.getResponse().getStatus(), BAD_REQUEST.getStatusCode()); } try { RestcommCallsTool.getInstance().getCalls(deploymentUrl.toString(), adminAccountSid, adminAuthToken, 0, 10, "DateCreated:invalid", true); } catch (UniformInterfaceException e) { assertEquals(e.getResponse().getStatus(), BAD_REQUEST.getStatusCode()); } }