@Override public Object cacheGet(Object key) { return cacheGet(key, null); }
@Test public void testDefaultReturnedFromCacheGetWhenNoValueWasPut() { Object key = new Object(); Object value = new Object(); QueryExecutionContext context = new QueryExecutionContext(null, null); assertEquals(value, context.cacheGet(key, value)); }
@Test public void testNullReturnedFromCacheGetWhenNoValueWasPut() { Object key = new Object(); QueryExecutionContext context = new QueryExecutionContext(null, null); assertNull(context.cacheGet(key)); }
@Test public void testPutValueReturnedFromCacheGet() { Object key = new Object(); Object value = new Object(); QueryExecutionContext context = new QueryExecutionContext(null, null); context.cachePut(key, value); assertEquals(value, context.cacheGet(key)); }
@Test public void testExecCachesCanBePushedAndValuesRetrievedAtTheCorrectLevel() { Object key = new Object(); Object value = new Object(); QueryExecutionContext context = new QueryExecutionContext(null, null); context.pushExecCache(1); context.cachePut(key, value); context.pushExecCache(2); assertNull(context.cacheGet(key)); context.popExecCache(); assertEquals(value, context.cacheGet(key)); }