use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconRendererTest method renderWithException.
@Test
public void renderWithException() throws Exception {
IconSet iconSet = new IconSet("default");
iconSet.setRenderWiki("image:$icon.png");
iconSet.addIcon("test", new Icon("blabla"));
IconException exception = new IconException("exception", null);
when(velocityRenderer.render(any())).thenThrow(exception);
// Test
IconException caughtException = null;
try {
mocker.getComponentUnderTest().render("test", iconSet);
} catch (IconException e) {
caughtException = e;
}
// Verify
assertNotNull(caughtException);
assertEquals(exception, caughtException);
}
use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconRendererTest method renderWithJSX.
@Test
public void renderWithJSX() throws Exception {
IconSet iconSet = new IconSet("default");
iconSet.setJsx("jsx");
iconSet.addIcon("test", new Icon("blabla"));
// Test
mocker.getComponentUnderTest().render("test", iconSet);
// Verify
verify(jsExtension).use("jsx");
verify(linkExtension, never()).use(any());
verify(skinExtension, never()).use(any());
}
use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconRendererTest method renderNonExistentIcon.
@Test
public void renderNonExistentIcon() throws Exception {
IconSet iconSet = new IconSet("default");
// Test
String result = mocker.getComponentUnderTest().render("non-existent-icon", iconSet);
// Verify
assertEquals("", result);
}
use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconSetCacheTest method putByName.
@Test
public void putByName() throws Exception {
IconSet iconSet = new IconSet("key");
mocker.getComponentUnderTest().put("key", iconSet);
verify(cache).set("NAMED:key", iconSet);
}
use of org.xwiki.icon.IconSet in project xwiki-platform by xwiki.
the class DefaultIconSetCacheTest method getByName.
@Test
public void getByName() throws Exception {
IconSet iconSet = new IconSet("key");
when(cache.get("NAMED:key")).thenReturn(iconSet);
IconSet result = mocker.getComponentUnderTest().get("key");
assertTrue(iconSet == result);
}
Aggregations