### Question:
DefaultWikiMacroFactory implements WikiMacroFactory, WikiMacroConstants { @Override public boolean containsWikiMacro(DocumentReference documentReference) { boolean result; try { XWikiDocument doc = getContext().getWiki().getDocument(documentReference, getContext()); BaseObject macroDefinition = doc.getObject(WIKI_MACRO_CLASS); result = (null != macroDefinition); } catch (XWikiException ex) { result = false; } return result; }  @Override WikiMacro createWikiMacro(DocumentReference documentReference); @Override boolean containsWikiMacro(DocumentReference documentReference); @Override boolean isAllowed(DocumentReference documentReference, WikiMacroVisibility visibility);  }### Answer:
@Test public void containsWikiMacro() { assertTrue(this.wikiMacroFactory.containsWikiMacro(DOCUMENT_REFERENCE)); this.macroDefinitionDoc.removeXObject(this.macroObject); saveDocument(); assertFalse(this.wikiMacroFactory.containsWikiMacro(DOCUMENT_REFERENCE)); }