MacroFactory implements Lifecycle { public List<CompilationMessage> verifyGroovyMacro(String code) { return groovyMacroScanner.verifyMacro(code); }  @Override void start(); @Override void stop(); @Override boolean isRunning(); IMacro get(String macroName); Set<IMacroDescriptor> getDescriptors(); List<String> listGroovyMacros(); String getGroovyMacroCode(String name); List<CompilationMessage> verifyGroovyMacro(String code); void saveGroovyMacro(String name, String code); void deleteGroovyMacro(String name); Object getData(String macroName, String request, Map<String, String[]> parameterMap, Authentication authentication);  }
@Test public void test() { List<CompilationMessage> errors = Lists.newArrayList(mock(CompilationMessage.class)); when(groovyMacroScanner.verifyMacro("code")).thenReturn(errors); List<CompilationMessage> result = macroFactory.verifyGroovyMacro("code"); assertEquals(errors, result); }