### Question:
RenderingScriptService implements ScriptService { public MacroId resolveMacroId(String macroIdAsString) { try { return this.macroIdFactory.createMacroId(macroIdAsString); } catch (ParseException e) { this.logger.warn("Failed to resolve macro id [{}]. Root cause is: [{}]", macroIdAsString, ExceptionUtils.getRootCauseMessage(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 resolveMacroId() throws Exception { MacroId macroId = new MacroId("info", Syntax.XWIKI_2_1); MacroIdFactory macroIdFactory = this.mocker.registerMockComponent(MacroIdFactory.class); when(macroIdFactory.createMacroId(macroId.toString())).thenReturn(macroId); assertSame(macroId, this.mocker.getComponentUnderTest().resolveMacroId(macroId.toString())); }
@Test public void resolveMacroIdInvalid() throws Exception { MacroIdFactory macroIdFactory = this.mocker.registerMockComponent(MacroIdFactory.class); when(macroIdFactory.createMacroId("foo")).thenThrow(new ParseException("Invalid macro id")); assertNull(this.mocker.getComponentUnderTest().resolveMacroId("foo")); }