### Question:
ExpandedMacroBlock extends MacroBlock { @Override public String getContent() { WikiPrinter printer = new DefaultWikiPrinter(); XDOM xdom; if (getChildren().size() == 1 && getChildren().get(0) instanceof XDOM) { xdom = (XDOM) getChildren().get(0); } else { xdom = new XDOM(getChildren()); } getContentRenderer().render(xdom, printer); return printer.toString(); } ExpandedMacroBlock(String id, Map<String, String> parameters, BlockRenderer contentRenderer, boolean inline);  ExpandedMacroBlock(String id, Map<String, String> parameters, BlockRenderer contentRenderer, boolean inline,
        ComponentManager componentManager); @Override String getContent();  }### Answer:
@Test public void getContentWrapsChildNodesInXDOM() { ExpandedMacroBlock expandedMacroBlock = new ExpandedMacroBlock("gallery", Collections.<String, String>emptyMap(), this.contentRenderer, false); expandedMacroBlock.getContent(); ArgumentCaptor<Block> block = ArgumentCaptor.forClass(Block.class); verify(this.contentRenderer).render(block.capture(), any(WikiPrinter.class)); assertTrue(block.getValue() instanceof XDOM); assertEquals(0, block.getValue().getChildren().size()); }
@Test public void getContentUsesChildXDOM() { XDOM content = new XDOM(Collections.<Block>emptyList()); ExpandedMacroBlock expandedMacroBlock = new ExpandedMacroBlock("gallery", Collections.<String, String>emptyMap(), this.contentRenderer, false); expandedMacroBlock.addChild(content); expandedMacroBlock.getContent(); verify(this.contentRenderer).render(same(content), any(WikiPrinter.class)); }
@Test public void getContentUsesAnotherBlockRenderer() throws Exception { ExpandedMacroBlock expandedMacroBlock = new ExpandedMacroBlock("gallery", Collections.<String, String>emptyMap(), this.contentRenderer, false, this.componentManager); XDOM parent = new XDOM(Collections.singletonList(expandedMacroBlock)); parent.getMetaData().addMetaData(MetaData.SYNTAX, Syntax.MARKDOWN_1_1); BlockRenderer markdownRenderer = mock(BlockRenderer.class); when(this.componentManager.hasComponent(BlockRenderer.class, Syntax.MARKDOWN_1_1.toIdString())) .thenReturn(true); when(this.componentManager.getInstance(BlockRenderer.class, Syntax.MARKDOWN_1_1.toIdString())) .thenReturn(markdownRenderer); expandedMacroBlock.getContent(); verify(markdownRenderer).render(any(XDOM.class), any(WikiPrinter.class)); verify(this.contentRenderer, never()).render(any(XDOM.class), any(WikiPrinter.class)); }