示例#1
0
 @Test
 public void detailsReturnsJson()
     throws ParseException, EmptyResponse, InvalidFormat, InvalidResponse, APIError, RequestFailed,
         EmptySession, EmptyUsername, InvalidUsername {
   Task task = setUp();
   JSONParser parser = new JSONParser();
   JSONObject json = (JSONObject) parser.parse("{\"info\":{\"info\":\"info\"}}");
   expect(task.fetch(isA(String.class), isA(String.class))).andReturn(json);
   replay(task);
   JSONObject obj = (JSONObject) parser.parse("{\"info\":\"info\"}");
   assertEquals(obj, task.details(123));
 }
示例#2
0
 @Test
 public void listAllReturnsArray()
     throws ParseException, EmptyResponse, InvalidFormat, InvalidResponse, APIError, RequestFailed,
         EmptySession, EmptyUsername, InvalidUsername {
   Task task = setUp();
   JSONParser parser = new JSONParser();
   JSONObject json = (JSONObject) parser.parse("{\"list\":[\"response\"]}");
   expect(task.fetch(isA(String.class), isA(String.class))).andReturn(json);
   replay(task);
   JSONArray array = new JSONArray();
   array.add("response");
   assertEquals(array, task.listAll());
 }