### Question:
CollectMacroEvaluator implements MacroEvaluator { public Macros getMacros() { return new Macros(lookupProperties, macroFunctions); } CollectMacroEvaluator(); @Override String lookup(String property); @Override String evaluate(String macroFunction, String... arguments); Macros getMacros();  }### Answer:
@Test public void testMacrosCollected() { CollectMacroEvaluator collectMacroEvaluator = new CollectMacroEvaluator(); MacroParser parser = new MacroParser(collectMacroEvaluator); List<String> macros = new ArrayList<>(); macros.add("${hello}${world}"); macros.add("${secure2(password)}"); macros.add("${hello}"); for (String macro : macros) { parser.parse(macro); } Set<String> expectedLookups = new HashSet<>(); expectedLookups.add("hello"); expectedLookups.add("world"); Assert.assertEquals(expectedLookups, collectMacroEvaluator.getMacros().getLookups()); Map<String, List<String>> functionNameToArguments = new HashMap<>(); functionNameToArguments.put("secure2", ImmutableList.of("password")); for (MacroFunction macroFunction : collectMacroEvaluator.getMacros().getMacroFunctions()) { Assert.assertTrue(functionNameToArguments.containsKey(macroFunction.getFunctionName())); Assert.assertEquals(functionNameToArguments.get(macroFunction.getFunctionName()), macroFunction.getArguments()); } }