### Question:
I18nManagerCacheWrapper extends AbstractGenericCacheWrapper<ApsProperties> implements II18nManagerCacheWrapper { @Override public void initCache(II18nDAO i18nDAO) throws ApsSystemException { try { Cache cache = this.getCache(); this.releaseCachedObjects(cache); Map<String, ApsProperties> labels = i18nDAO.loadLabelGroups(); this.insertObjectsOnCache(cache, labels); } catch (Throwable t) { logger.error("Error loading labels", t); throw new ApsSystemException("Error loading labels", t); } }  @Override void initCache(II18nDAO i18nDAO); @Override Map<String, ApsProperties> getLabelGroups(); @Override ApsProperties getLabelGroup(String key); @Override void addLabelGroup(String key, ApsProperties labels); @Override void updateLabelGroup(String key, ApsProperties labels); @Override void removeLabelGroup(String key);  }### Answer:
@Test public void testInitCache() throws Exception { Cache fakeCache = Mockito.mock(Cache.class); when(this.springCacheManager.getCache(CACHE_NAME)).thenReturn(fakeCache); ApsProperties properties = I18nManagerTest.createLabel("It Label", "En Label"); Map<String, ApsProperties> labels = new HashMap<>(); labels.put(TEST_KEY, properties); when(this.i18nDAO.loadLabelGroups()).thenReturn(labels); this.cacheWrapper.initCache(this.i18nDAO); Mockito.verify(fakeCache, Mockito.times(1)).put(Mockito.anyString(), Mockito.any(ApsProperties.class)); }
@Test(expected = ApsSystemException.class) public void testInitCacheWithErrors() throws Exception { Cache fakeCache = Mockito.mock(Cache.class); when(this.springCacheManager.getCache(CACHE_NAME)).thenReturn(fakeCache); Mockito.doThrow(RuntimeException.class).when(fakeCache).get(Mockito.anyString()); try { this.cacheWrapper.initCache(this.i18nDAO); Assert.fail(); } catch (Exception e) { throw e; } finally { Mockito.verify(fakeCache, Mockito.times(0)).put(Mockito.anyString(), Mockito.any(ApsProperties.class)); } }