@Test
public void testAddDuplicateCachesNonSingleton() throws Exception {
// You should be able to add caches with the same name to non singleton instances
// of the cache manager because they each have their own copies of caches to manage.
// The caches are uniquely identified by the cache managers by using the instance id.
DozerCacheManager cacheMgr2 = new DozerCacheManager();
// add cache to each cache mgr instance
String cacheName = getRandomString();
cacheMgr.addCache(cacheName, 1);
cacheMgr2.addCache(cacheName, 1);
assertTrue("cache should exist in cache mgr1", cacheMgr.cacheExists(cacheName));
assertTrue("cache should also exist in cache mgr2", cacheMgr2.cacheExists(cacheName));
Cache cache1 = cacheMgr.getCache(cacheName);
Cache cache2 = cacheMgr2.getCache(cacheName);
assertFalse("caches should not be the same instance", cache1 == cache2);
assertEquals("invalid cache name", cacheName, cache1.getName());
assertEquals("invalid cache name for cache2", cacheName, cache2.getName());
}