@Test public void createWikiMacro() throws Exception { WikiMacro macro = this.wikiMacroFactory.createWikiMacro(DOCUMENT_REFERENCE); assertNotNull(macro); assertEquals("testmacro", macro.getId()); assertEquals("testmacro", macro.getDescriptor().getId().getId()); assertEquals("Test Macro", macro.getDescriptor().getName()); assertEquals("This is a macro used for testing purposes.", macro.getDescriptor().getDescription()); assertEquals("Test", macro.getDescriptor().getDefaultCategory()); assertEquals(WikiMacroVisibility.USER, ((WikiMacroDescriptor) macro.getDescriptor()).getVisibility()); assertTrue(macro.supportsInlineMode()); assertNull(macro.getDescriptor().getContentDescriptor()); assertTrue(macro.getDescriptor().getParameterDescriptorMap().isEmpty()); assertNull(macro.getDescriptor().getId().getSyntax()); }
@Override public WikiMacro createWikiMacro(DocumentReference documentReference) throws WikiMacroException { XWikiDocument doc; try { doc = getContext().getWiki().getDocument(documentReference, getContext()); } catch (XWikiException ex) { throw new WikiMacroException( String.format("Could not build macro from : [%s], unable to load document", documentReference), ex); } return buildMacro(doc); }
DefaultWikiMacroFactory implements WikiMacroFactory, WikiMacroConstants { @Override public WikiMacro createWikiMacro(DocumentReference documentReference) throws WikiMacroException { XWikiDocument doc; try { doc = getContext().getWiki().getDocument(documentReference, getContext()); } catch (XWikiException ex) { throw new WikiMacroException( String.format("Could not build macro from : [%s], unable to load document", documentReference), ex); } return buildMacro(doc); } }
DefaultWikiMacroFactory implements WikiMacroFactory, WikiMacroConstants { @Override public WikiMacro createWikiMacro(DocumentReference documentReference) throws WikiMacroException { XWikiDocument doc; try { doc = getContext().getWiki().getDocument(documentReference, getContext()); } catch (XWikiException ex) { throw new WikiMacroException( String.format("Could not build macro from : [%s], unable to load document", documentReference), ex); } return buildMacro(doc); }  }
DefaultWikiMacroFactory implements WikiMacroFactory, WikiMacroConstants { @Override public WikiMacro createWikiMacro(DocumentReference documentReference) throws WikiMacroException { XWikiDocument doc; try { doc = getContext().getWiki().getDocument(documentReference, getContext()); } catch (XWikiException ex) { throw new WikiMacroException( String.format("Could not build macro from : [%s], unable to load document", documentReference), ex); } return buildMacro(doc); }  @Override WikiMacro createWikiMacro(DocumentReference documentReference); @Override boolean containsWikiMacro(DocumentReference documentReference); @Override boolean isAllowed(DocumentReference documentReference, WikiMacroVisibility visibility); }
DefaultWikiMacroFactory implements WikiMacroFactory, WikiMacroConstants { @Override public WikiMacro createWikiMacro(DocumentReference documentReference) throws WikiMacroException { XWikiDocument doc; try { doc = getContext().getWiki().getDocument(documentReference, getContext()); } catch (XWikiException ex) { throw new WikiMacroException( String.format("Could not build macro from : [%s], unable to load document", documentReference), ex); } return buildMacro(doc); }  @Override WikiMacro createWikiMacro(DocumentReference documentReference); @Override boolean containsWikiMacro(DocumentReference documentReference); @Override boolean isAllowed(DocumentReference documentReference, WikiMacroVisibility visibility);  }