@Test public void onEventWhenNoObjects() throws Exception { XWikiDocument doc = mock(XWikiDocument.class); when(doc.getXObject(any(DocumentReference.class))).thenReturn(null); mocker.getComponentUnderTest().onEvent(null, doc, null); verify(iconSetCache, never()).clear(any(DocumentReference.class)); }
@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);  }