### Question:
ContextHolderCache { public synchronized ContextHolder createCachedContextHolder() { updateCacheSize(); while (true) { final String key = UUID.randomUUID().toString(); if (!cache.containsKey(key)) { final ContextHolder holder = new ContextHolder(key); cache.put(key, holder); return holder; } } } @Inject  ContextHolderCache(ContextCacheSize contextCacheSize); synchronized ContextHolder get(String key); synchronized ContextHolder remove(String key); synchronized ContextHolder createCachedContextHolder(); synchronized ContextHolder put(String key, ContextHolder contextHolder); synchronized int size(); synchronized int getMaxSize();  }### Answer:
@Test public void createCachedContextHolder() { final ContextCacheSize cacheSize = mock(ContextCacheSize.class); when(cacheSize.getDesiredCacheSize()).thenReturn(5); final ContextHolderCache cache = new ContextHolderCache(cacheSize); final ContextHolder cachedContext = cache.createCachedContextHolder(); assertThat(cachedContext).isNotNull(); assertThat(cachedContext.getCacheKey()).isNotNull(); }