EasyMock.verify(resp);
}
public void testScope(){
CacheKey key = new SimpleCacheKey("first");
Response resp = EasyMock.createMock(Response.class);
EasyMock.replay(resp);
storage.putResult(key, resp);
String scope = "admin";
CacheKey scopedKey = new SimpleCacheKey("first scoped");
CacheKey secondScopedKey = new SimpleCacheKey("second scoped");
Response scopedResp = EasyMock.createMock(Response.class);
EasyMock.replay(scopedResp);
storage.putResult(scopedKey, scopedResp, scope);
storage.putResult(secondScopedKey, scopedResp, scope);
// check the cache content
assertNull(storage.getResultOrReturnNull(new SimpleCacheKey("unknown")));
assertNull(storage.getResultOrReturnNull(new SimpleCacheKey("unknown"), scope));
assertNull(storage.getResultOrReturnNull(key, scope));
assertEquals(resp, ((ResponseWrapper)storage.getResultOrReturnNull(key)).response);
assertEquals(scopedResp, ((ResponseWrapper)storage.getResultOrReturnNull(scopedKey, scope)).response);
assertEquals(scopedResp, ((ResponseWrapper)storage.getResultOrReturnNull(secondScopedKey, scope)).response);