Search in sources :

Example 1 with MemoryPolicy

use of com.nytimes.android.external.store3.base.impl.MemoryPolicy in project Store by NYTimes.

the class NoopPersisterTest method testReadingOfMemoryPolicies.

// https://github.com/NYTimes/Store/issues/312
@Test
public void testReadingOfMemoryPolicies() {
    MemoryPolicy expireAfterWritePolicy = MemoryPolicy.builder().setExpireAfterWrite(1).setExpireAfterTimeUnit(TimeUnit.HOURS).build();
    NoopPersister.create(expireAfterWritePolicy);
    MemoryPolicy expireAfterAccessPolicy = MemoryPolicy.builder().setExpireAfterAccess(1).setExpireAfterTimeUnit(TimeUnit.HOURS).build();
    NoopPersister.create(expireAfterAccessPolicy);
    exception.expect(IllegalArgumentException.class);
    exception.expectMessage("No expiry policy set");
    MemoryPolicy incompletePolicy = MemoryPolicy.builder().setExpireAfterTimeUnit(TimeUnit.HOURS).build();
    NoopPersister.create(incompletePolicy);
}
Also used : MemoryPolicy(com.nytimes.android.external.store3.base.impl.MemoryPolicy) Test(org.junit.Test)

Aggregations

MemoryPolicy (com.nytimes.android.external.store3.base.impl.MemoryPolicy)1 Test (org.junit.Test)1