public void followNextLink() { if (nextRequest != null) { appendResults = true; currentRequest = nextRequest; currentRequest.setCallback(new Request.Callback() { @Override public void onCompleted(Response response) { requestCompleted(response); } }); loading = true; CacheableRequestBatch batch = putRequestIntoBatch(currentRequest, skipRoundtripIfCached); Request.executeBatchAsync(batch); } }
@SmallTest @MediumTest @LargeTest public void testCreateEmptyRequestBatch() { CacheableRequestBatch batch = new CacheableRequestBatch(); Request meRequest = Request.newMeRequest(null, null); assertEquals(0, batch.size()); batch.add(meRequest); assertEquals(1, batch.size()); assertEquals(meRequest, batch.get(0)); String key = "The Key"; assertNull(batch.getCacheKeyOverride()); batch.setCacheKeyOverride(key); assertEquals(key, batch.getCacheKeyOverride()); assertTrue(!batch.getForceRoundTrip()); batch.setForceRoundTrip(true); assertTrue(batch.getForceRoundTrip()); }