* @throws Exception
*/
public void test2ObjectAddGetCachedObject() throws Exception {
String testString = new String( "This is a test");
Object retrievedObject = null;
CachedObject cacheObject1 = null;
CachedObject cacheObject2 = null;
GlobalCacheService globalCache = (GlobalCacheService)TurbineServices
.getInstance()
.getService( GlobalCacheService.SERVICE_NAME );
// Create and add Object #1
cacheObject1 = new CachedObject(testString);
assertNotNull( "Failed to create a cachable object 1", cacheObject1);
globalCache.addObject(cacheKey, cacheObject1);
retrievedObject = globalCache.getObject(cacheKey);
assertNotNull( "Did not retrieved a cached object 1", retrievedObject);
assertEquals( "Did not retrieved correct cached object", cacheObject1, retrievedObject);
// Create and add Object #2
cacheObject2 = new CachedObject(testString);
assertNotNull( "Failed to create a cachable object 2", cacheObject2);
globalCache.addObject(cacheKey_2, cacheObject2);
retrievedObject = globalCache.getObject(cacheKey_2);
assertNotNull( "Did not retrieved a cached object 2", retrievedObject);
assertEquals( "Did not retrieved correct cached object 2", cacheObject2, retrievedObject);