### Question:
LRUCacheManager implements CacheManager { @SuppressWarnings("unchecked") @Override public <K, V> Cache<K, V> getCache(final String name, boolean soft) { Cache<K, V> cache = (Cache<K, V>) caches.computeIfAbsent(name, n -> this.newCache(soft)); if ((soft && !(cache instanceof LRUSoftCache)) || (!soft && (cache instanceof LRUSoftCache))) { LOG.warn("Cache {} is being used in mixed 'soft' and 'hard' mode", name); } return cache; } LRUCacheManager(final int maxElements); @Override void evictAll(); @SuppressWarnings("unchecked") @Override Cache<K, V> getCache(final String name, boolean soft);  }### Answer:
@Test public void testEviction() { CacheManager manager = new LRUCacheManager(2); Cache<String, Object> cache = manager.getCache("cache", this.soft); String one = "1"; String two = "2"; String three = "3"; cache.put(one, one); cache.put(two, two); cache.put(three, three); assertThat(cache.size()).isEqualTo(2); assertThat(cache.get(one)).isNull(); assertThat(cache.get(two)).isNotNull(); assertThat(cache.get(three)).isNotNull(); }
@Test public void testIdentity() { CacheManager manager = new LRUCacheManager(2); Cache<String, String> cache1 = manager.getCache("cache", this.soft); Cache<String, String> cache2 = manager.getCache("cache", this.soft); Cache<String, String> cache3 = manager.getCache("cache", !this.soft); assertThat(cache1).isEqualTo(cache2); assertThat(cache1).isEqualTo(cache3); }