@Test public void onEvent() throws Exception { XWikiDocument doc = mock(XWikiDocument.class); List<BaseObject> list = new ArrayList<BaseObject>(); BaseObject obj = mock(BaseObject.class); list.add(obj); when(obj.getStringValue("name")).thenReturn("icontheme1"); DocumentReference docRef = new DocumentReference("wikiA", "b", "c"); when(doc.getDocumentReference()).thenReturn(docRef); LocalDocumentReference iconThemeClassRef = new LocalDocumentReference("IconThemesCode", "IconThemeClass"); when(doc.getXObjects(eq(iconThemeClassRef))).thenReturn(list); mocker.getComponentUnderTest().onEvent(null, doc, null); verify(iconSetCache, atLeastOnce()).clear(docRef); verify(iconSetCache, atLeastOnce()).clear("icontheme1", "wikiA"); }
@Override public void onEvent(Event event, Object source, Object data) { XWikiDocument document = (XWikiDocument) source; List<BaseObject> iconThemeObjects = document.getXObjects(ICON_THEME_CLASS); if (iconThemeObjects != null && !iconThemeObjects.isEmpty()) { iconSetCache.clear(document.getDocumentReference()); BaseObject iconThemeObj = iconThemeObjects.get(0); String iconThemeName = iconThemeObj.getStringValue("name"); String currentWiki = document.getDocumentReference().getWikiReference().getName(); iconSetCache.clear(iconThemeName, currentWiki); } }
IconThemeListener implements EventListener { @Override public void onEvent(Event event, Object source, Object data) { XWikiDocument document = (XWikiDocument) source; List<BaseObject> iconThemeObjects = document.getXObjects(ICON_THEME_CLASS); if (iconThemeObjects != null && !iconThemeObjects.isEmpty()) { iconSetCache.clear(document.getDocumentReference()); BaseObject iconThemeObj = iconThemeObjects.get(0); String iconThemeName = iconThemeObj.getStringValue("name"); String currentWiki = document.getDocumentReference().getWikiReference().getName(); iconSetCache.clear(iconThemeName, currentWiki); } } }
IconThemeListener implements EventListener { @Override public void onEvent(Event event, Object source, Object data) { XWikiDocument document = (XWikiDocument) source; List<BaseObject> iconThemeObjects = document.getXObjects(ICON_THEME_CLASS); if (iconThemeObjects != null && !iconThemeObjects.isEmpty()) { iconSetCache.clear(document.getDocumentReference()); BaseObject iconThemeObj = iconThemeObjects.get(0); String iconThemeName = iconThemeObj.getStringValue("name"); String currentWiki = document.getDocumentReference().getWikiReference().getName(); iconSetCache.clear(iconThemeName, currentWiki); } }  }
IconThemeListener implements EventListener { @Override public void onEvent(Event event, Object source, Object data) { XWikiDocument document = (XWikiDocument) source; List<BaseObject> iconThemeObjects = document.getXObjects(ICON_THEME_CLASS); if (iconThemeObjects != null && !iconThemeObjects.isEmpty()) { iconSetCache.clear(document.getDocumentReference()); BaseObject iconThemeObj = iconThemeObjects.get(0); String iconThemeName = iconThemeObj.getStringValue("name"); String currentWiki = document.getDocumentReference().getWikiReference().getName(); iconSetCache.clear(iconThemeName, currentWiki); } }  @Override String getName(); @Override List<Event> getEvents(); @Override void onEvent(Event event, Object source, Object data); }
IconThemeListener implements EventListener { @Override public void onEvent(Event event, Object source, Object data) { XWikiDocument document = (XWikiDocument) source; List<BaseObject> iconThemeObjects = document.getXObjects(ICON_THEME_CLASS); if (iconThemeObjects != null && !iconThemeObjects.isEmpty()) { iconSetCache.clear(document.getDocumentReference()); BaseObject iconThemeObj = iconThemeObjects.get(0); String iconThemeName = iconThemeObj.getStringValue("name"); String currentWiki = document.getDocumentReference().getWikiReference().getName(); iconSetCache.clear(iconThemeName, currentWiki); } }  @Override String getName(); @Override List<Event> getEvents(); @Override void onEvent(Event event, Object source, Object data);  }