### Question:
RenderingScriptService implements ScriptService { public MacroDescriptor getMacroDescriptor(MacroId macroId) { if (this.macroManager.exists(macroId)) { try { return this.macroManager.getMacro(macroId).getDescriptor(); } catch (MacroLookupException e) { } } return null; }  List<Syntax> getAvailableParserSyntaxes(); List<Syntax> getAvailableRendererSyntaxes(); List<String> getDefaultTransformationNames(); XDOM parse(String text, String syntaxId); String render(Block block, String outputSyntaxId); Syntax resolveSyntax(String syntaxId); String escape(String content, Syntax syntax); List<Syntax> getConfiguredSyntaxes(); List<Syntax> getDisabledSyntaxes(); List<MacroDescriptor> getMacroDescriptors(Syntax syntax); MacroId resolveMacroId(String macroIdAsString); MacroDescriptor getMacroDescriptor(MacroId macroId);  }### Answer:
@Test public void getMacroDescriptor() throws Exception { MacroId macroId = new MacroId("macroId"); Macro macro = mock(Macro.class); MacroDescriptor macroDescriptor = mock(MacroDescriptor.class); MacroManager macroManager = this.mocker.registerMockComponent(MacroManager.class); when(macroManager.exists(macroId)).thenReturn(true); when(macroManager.getMacro(macroId)).thenReturn(macro); when(macro.getDescriptor()).thenReturn(macroDescriptor); assertSame(macroDescriptor, this.mocker.getComponentUnderTest().getMacroDescriptor(macroId)); }
@Test public void getMacroDescriptorNotFound() throws Exception { MacroId macroId = new MacroId("macroId"); MacroManager macroManager = this.mocker.registerMockComponent(MacroManager.class); when(macroManager.exists(macroId)).thenReturn(false); assertNull(this.mocker.getComponentUnderTest().getMacroDescriptor(macroId)); }