### Question:
DefaultMacroCategoryManager implements MacroCategoryManager { @Override public Set<MacroId> getMacroIds(String category) throws MacroLookupException { return getMacroIds(category, null); }  @Override Set<String> getMacroCategories(); @Override Set<String> getMacroCategories(final Syntax syntax); @Override Set<MacroId> getMacroIds(String category); @Override Set<MacroId> getMacroIds(String category, final Syntax syntax);  }### Answer:
@Test public void testGetMacroNamesForCategory() throws Exception { final Macro testMacro1 = registerMockComponent(Macro.class, "mytestmacro1", "mock1"); final Macro testMacro2 = registerMockComponent(Macro.class, "mytestmacro2", "mock2"); getMockery().checking(new Expectations(){{ allowing(testMacro1).getDescriptor(); will(returnValue(new DefaultMacroDescriptor(new MacroId("macro1"), "Test macro - 1"))); allowing(testMacro2).getDescriptor(); will(returnValue(new DefaultMacroDescriptor(new MacroId("macro2"), "Test macro - 2"))); }}); DefaultMacroTransformationConfiguration configuration = (DefaultMacroTransformationConfiguration) getComponentManager().getInstance( MacroTransformationConfiguration.class); configuration.addCategory(new MacroId("mytestmacro1"), "Cat1"); configuration.addCategory(new MacroId("mytestmacro2"), "Cat2"); Set<MacroId> macroIds = this.macroCategoryManager.getMacroIds("Cat1"); Assert.assertTrue(macroIds.contains(new MacroId("mytestmacro1"))); Assert.assertFalse(macroIds.contains(new MacroId("mytestmacro2"))); macroIds = this.macroCategoryManager.getMacroIds("Cat1", Syntax.JSPWIKI_1_0); Assert.assertTrue(macroIds.contains(new MacroId("mytestmacro1"))); getComponentManager().unregisterComponent(Macro.class, "mytestmacro1"); getComponentManager().unregisterComponent(Macro.class, "mytestmacro2"); }
@Test public void testGetMacroIdsWithSyntaxSpecificMacros() throws Exception { final Macro mockMacro = registerMockComponent(Macro.class, "mytestmacro/xwiki/2.0"); getMockery().checking(new Expectations(){{ allowing(mockMacro).getDescriptor(); will(returnValue(new DefaultMacroDescriptor(new MacroId("test"), "Test macro"))); }}); DefaultMacroTransformationConfiguration configuration = (DefaultMacroTransformationConfiguration) getComponentManager().getInstance( MacroTransformationConfiguration.class); configuration.addCategory(new MacroId("mytestmacro", Syntax.XWIKI_2_0), "Test"); Set<MacroId> macroIds = this.macroCategoryManager.getMacroIds("Test"); Assert.assertTrue(macroIds.contains(new MacroId("mytestmacro", Syntax.XWIKI_2_0))); macroIds = this.macroCategoryManager.getMacroIds("Test", Syntax.XWIKI_2_0); Assert.assertTrue(macroIds.contains(new MacroId("mytestmacro", Syntax.XWIKI_2_0))); macroIds = this.macroCategoryManager.getMacroIds("Test", Syntax.JSPWIKI_1_0); Assert.assertFalse(macroIds.contains(new MacroId("mytestmacro"))); getComponentManager().unregisterComponent(Macro.class, "mytestmacro/xwiki/2.0"); }