### Question:
JCacheManager implements javax.cache.CacheManager { @Override public <T> T unwrap(final Class<T> clazz) { if(clazz.isAssignableFrom(getClass())) { return clazz.cast(this); } if(clazz.isAssignableFrom(cacheManager.getClass())) { return clazz.cast(cacheManager); } throw new IllegalArgumentException(); } JCacheManager(final JCacheCachingProvider jCacheCachingProvider, final CacheManager cacheManager, final URI uri, final Properties props); @Override JCacheCachingProvider getCachingProvider(); @Override URI getURI(); @Override ClassLoader getClassLoader(); @Override Properties getProperties(); @Override Cache<K, V> createCache(final String cacheName, final C configuration); @Override Cache<K, V> getCache(final String cacheName, final Class<K> keyType, final Class<V> valueType); @Override Cache<K, V> getCache(final String cacheName); @Override Iterable<String> getCacheNames(); @Override void destroyCache(final String cacheName); @Override void enableManagement(final String cacheName, final boolean enabled); @Override void enableStatistics(final String cacheName, final boolean enabled); @Override void close(); @Override boolean isClosed(); @Override T unwrap(final Class<T> clazz); ExecutorService getExecutorService();  }### Answer:
@Test public void testUnwrapReturnsCacheManagerType() { JCacheManager jCacheManager = new JCacheManager(null, CacheManager.getInstance(), null, null); final CacheManager unwrap = jCacheManager.unwrap(CacheManager.class); assertThat(unwrap, notNullValue()); assertThat(unwrap, instanceOf(CacheManager.class)); }
@Test public void testUnwrapThrowsOnUnsupportedType() { JCacheManager jCacheManager = new JCacheManager(null, CacheManager.getInstance(), null, null); try { jCacheManager.unwrap(Cache.class); fail(); } catch (IllegalArgumentException e) { } }