@Test public void createWikiMacroWithEmptyCode() throws Exception { this.macroObject.setStringValue(WikiMacroConstants.MACRO_CODE_PROPERTY, ""); saveDocument(); assertThrows(WikiMacroException.class, () -> this.wikiMacroFactory.createWikiMacro(DOCUMENT_REFERENCE)); }
@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);  }