use of org.xwiki.cache.CacheFactory in project xwiki-platform by xwiki.
the class DefaultIconSetCacheTest method initializeWhenError.
@Test
public void initializeWhenError() throws Exception {
DefaultIconSetCache cache = mocker.getComponentUnderTest();
CacheFactory cacheFactory = mock(CacheFactory.class);
when(cacheManager.getCacheFactory()).thenReturn(cacheFactory);
Exception exception = new CacheException("ERROR");
when(cacheFactory.newCache(any(CacheConfiguration.class))).thenThrow(exception);
Exception exceptionCaught = null;
try {
cache.initialize();
} catch (InitializationException e) {
exceptionCaught = e;
}
assertNotNull(exceptionCaught);
assertEquals("Failed to initialize the IconSet Cache.", exceptionCaught.getMessage());
assertEquals(exception, exceptionCaught.getCause());
}
Aggregations