Android CacheableRequestBatch - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android CacheableRequestBatch class.

This code example shows how to use the following methods:add, get, size, getCacheKeyOverride, getForceRoundTrip
 
    @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);

8
CodeRank
See Code Examples for Android CacheableRequestBatch Methods: