### Question:
DefaultSynchronizedCacheStrategyDecorator extends AbstractSynchronizedCacheStrategyDecorator<CacheKey, CacheValue> { public static CacheStrategy<CacheKey, CacheValue> decorate(final CacheStrategy<CacheKey, CacheValue> decorated) { return decorated instanceof DefaultSynchronizedCacheStrategyDecorator ? decorated : new DefaultSynchronizedCacheStrategyDecorator(decorated); } DefaultSynchronizedCacheStrategyDecorator(final CacheStrategy<CacheKey, CacheValue> cacheStrategy); static CacheStrategy<CacheKey, CacheValue> decorate(final CacheStrategy<CacheKey, CacheValue> decorated); @Override void clear(); @Override void destroy();  }### Answer:
@Test(expected = NullPointerException.class) public void cannotDecorateNullObject() { DefaultSynchronizedCacheStrategyDecorator.decorate(null); }
@Test public void shouldDecorateCacheStrategy() { final CacheStrategy<CacheKey, CacheValue> original = new LruMemoryCacheStrategy<CacheKey, CacheValue>(); victim = (DefaultSynchronizedCacheStrategyDecorator) DefaultSynchronizedCacheStrategyDecorator.decorate(original); assertTrue(victim instanceof DefaultSynchronizedCacheStrategyDecorator); assertSame(original, ((ObjectDecorator<?>) victim).getDecoratedObject()); }
@Test public void shouldNotRedundantlyDecorateCacheStrategy() { final CacheStrategy<CacheKey, CacheValue> original = DefaultSynchronizedCacheStrategyDecorator.decorate(new LruMemoryCacheStrategy<CacheKey, CacheValue>()); victim = (DefaultSynchronizedCacheStrategyDecorator) DefaultSynchronizedCacheStrategyDecorator.decorate(original); assertTrue(victim instanceof DefaultSynchronizedCacheStrategyDecorator); assertSame(original, victim); }