@Test(expected = EmptySession.class) public void detailsThrowsEmpySession() throws EmptySession, EmptyUsername, EmptyResponse, InvalidFormat, InvalidResponse, APIError, RequestFailed, InvalidUsername { Task task = setUp(); task.storage.purgeSession(); replay(task); task.details(123); }
@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)); }