Permalink
Browse files

TFJ-740 QueryResult extends TwitterResponse

  • Loading branch information...
1 parent 64c4faf commit b9f1fb0885624d40d1b923956ef4b8bb76715311 @yusuke committed Dec 21, 2012
@@ -23,7 +23,7 @@
*
* @author Yusuke Yamamoto - yusuke at mac.com
*/
-public interface QueryResult extends java.io.Serializable {
+public interface QueryResult extends TwitterResponse, java.io.Serializable {
long getSinceId();
long getMaxId();
@@ -35,7 +35,7 @@
*
* @author Yusuke Yamamoto - yusuke at mac.com
*/
-/*package*/ final class QueryResultJSONImpl implements QueryResult, java.io.Serializable {
+/*package*/ final class QueryResultJSONImpl extends TwitterResponseImpl implements QueryResult, java.io.Serializable {
private static final long serialVersionUID = -6781654399437121238L;
private long sinceId;
@@ -66,6 +66,7 @@
}
/*package*/ QueryResultJSONImpl(HttpResponse res, Configuration conf) throws TwitterException {
+ super(res);
JSONObject json = res.asJSONObject();
try {
JSONObject searchMetaData = json.getJSONObject("search_metadata");
@@ -64,6 +64,7 @@ public void testSearch() throws Exception {
String dateStr = format.format(new java.util.Date(System.currentTimeMillis() - 24 * 3600 * 1000));
Query query = new Query(queryStr).until(dateStr);
QueryResult queryResult = twitter1.search(query);
+ RateLimitStatus rateLimitStatus = queryResult.getRateLimitStatus();
assertTrue("sinceId", -1 != queryResult.getSinceId());
assertTrue(1265204883 < queryResult.getMaxId());
assertTrue(-1 != queryResult.getRefreshURL().indexOf(queryStr));
@@ -85,6 +86,7 @@ public void testSearch() throws Exception {
query = new Query("from:twit4j doesnothit");
queryResult = twitter1.search(query);
+ assertEquals(queryResult.getRateLimitStatus().getRemaining() + 1, rateLimitStatus.getRemaining());
assertEquals(0, queryResult.getSinceId());
// assertEquals(-1, queryResult.getMaxId());
// assertNull(queryResult.getRefreshUrl());

0 comments on commit b9f1fb0

Please sign in to comment.