@Test public void getDefaultIcon() throws Exception { InputStream is = getClass().getResourceAsStream("/test.iconset"); when(xwiki.getResourceAsStream("/resources/icons/default.iconset")).thenReturn(is); IconSet iconSet = new IconSet("default"); when(iconSetLoader.loadIconSet(any(InputStreamReader.class), eq("default"))).thenReturn(iconSet); IconSet result = mocker.getComponentUnderTest().getDefaultIconSet(); assertEquals(iconSet, result); verify(iconSetCache).put("default", iconSet); }
@Override public IconSet getDefaultIconSet() throws IconException { XWikiContext xcontext = xcontextProvider.get(); XWiki xwiki = xcontext.getWiki(); IconSet iconSet = iconSetCache.get(DEFAULT_ICONSET_NAME); if (iconSet == null) { try { iconSet = iconSetLoader.loadIconSet(new InputStreamReader( xwiki.getResourceAsStream("/resources/icons/default.iconset")), DEFAULT_ICONSET_NAME); iconSetCache.put(DEFAULT_ICONSET_NAME, iconSet); } catch (IconException | MalformedURLException e) { throw new IconException("Failed to get the current default icon set.", e); } } return iconSet; }
DefaultIconSetManager implements IconSetManager { @Override public IconSet getDefaultIconSet() throws IconException { XWikiContext xcontext = xcontextProvider.get(); XWiki xwiki = xcontext.getWiki(); IconSet iconSet = iconSetCache.get(DEFAULT_ICONSET_NAME); if (iconSet == null) { try { iconSet = iconSetLoader.loadIconSet(new InputStreamReader( xwiki.getResourceAsStream("/resources/icons/default.iconset")), DEFAULT_ICONSET_NAME); iconSetCache.put(DEFAULT_ICONSET_NAME, iconSet); } catch (IconException | MalformedURLException e) { throw new IconException("Failed to get the current default icon set.", e); } } return iconSet; } }
DefaultIconSetManager implements IconSetManager { @Override public IconSet getDefaultIconSet() throws IconException { XWikiContext xcontext = xcontextProvider.get(); XWiki xwiki = xcontext.getWiki(); IconSet iconSet = iconSetCache.get(DEFAULT_ICONSET_NAME); if (iconSet == null) { try { iconSet = iconSetLoader.loadIconSet(new InputStreamReader( xwiki.getResourceAsStream("/resources/icons/default.iconset")), DEFAULT_ICONSET_NAME); iconSetCache.put(DEFAULT_ICONSET_NAME, iconSet); } catch (IconException | MalformedURLException e) { throw new IconException("Failed to get the current default icon set.", e); } } return iconSet; }  }
DefaultIconSetManager implements IconSetManager { @Override public IconSet getDefaultIconSet() throws IconException { XWikiContext xcontext = xcontextProvider.get(); XWiki xwiki = xcontext.getWiki(); IconSet iconSet = iconSetCache.get(DEFAULT_ICONSET_NAME); if (iconSet == null) { try { iconSet = iconSetLoader.loadIconSet(new InputStreamReader( xwiki.getResourceAsStream("/resources/icons/default.iconset")), DEFAULT_ICONSET_NAME); iconSetCache.put(DEFAULT_ICONSET_NAME, iconSet); } catch (IconException | MalformedURLException e) { throw new IconException("Failed to get the current default icon set.", e); } } return iconSet; }  @Override IconSet getCurrentIconSet(); @Override IconSet getDefaultIconSet(); @Override IconSet getIconSet(String name); @Override List<String> getIconSetNames(); }
DefaultIconSetManager implements IconSetManager { @Override public IconSet getDefaultIconSet() throws IconException { XWikiContext xcontext = xcontextProvider.get(); XWiki xwiki = xcontext.getWiki(); IconSet iconSet = iconSetCache.get(DEFAULT_ICONSET_NAME); if (iconSet == null) { try { iconSet = iconSetLoader.loadIconSet(new InputStreamReader( xwiki.getResourceAsStream("/resources/icons/default.iconset")), DEFAULT_ICONSET_NAME); iconSetCache.put(DEFAULT_ICONSET_NAME, iconSet); } catch (IconException | MalformedURLException e) { throw new IconException("Failed to get the current default icon set.", e); } } return iconSet; }  @Override IconSet getCurrentIconSet(); @Override IconSet getDefaultIconSet(); @Override IconSet getIconSet(String name); @Override List<String> getIconSetNames();  }