示例#1
0
 @Test(expected = EmptySession.class)
 public void listAllThrowsEmpySession()
     throws EmptySession, EmptyUsername, EmptyResponse, InvalidFormat, InvalidResponse, APIError,
         RequestFailed, InvalidUsername {
   Task task = setUp();
   task.storage.purgeSession();
   replay(task);
   task.listAll();
 }
示例#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());
 }