@Test
  public void deleteMacro() throws IOException {
    scanner.deleteMacro(MACRO_NAME);

    File file = new File(macrosDir, MACRO_NAME + ".groovy"); // $NON-NLS-1$
    assertFalse(file.exists());
  }
  @Test
  public void saveMacro() throws IOException {
    scanner.saveMacro(MACRO_NAME, "code"); // $NON-NLS-1$

    File file = new File(macrosDir, MACRO_NAME + ".groovy"); // $NON-NLS-1$
    assertEquals("code", FileUtils.readFileToString(file, Charsets.UTF_8)); // $NON-NLS-1$
  }
  @Before
  public void setUp() throws IOException {
    File dataDir = tempDir.getRoot();
    when(settings.getDocumentrDataDir()).thenReturn(dataDir);

    macrosDir = new File(dataDir, GroovyMacroScanner.MACROS_DIR_NAME);
    File macroFile = new File(macrosDir, MACRO_NAME + ".groovy"); // $NON-NLS-1$
    FileUtils.writeStringToFile(macroFile, MACRO, Charsets.UTF_8);

    scanner.init();
  }
 @Test
 public void verifyMacroGood() {
   assertTrue(scanner.verifyMacro(MACRO).isEmpty());
 }
 @Test
 public void getMacroCode() throws IOException {
   String result = scanner.getMacroCode(MACRO_NAME);
   assertEquals(MACRO, result);
 }
 @Test
 public void listMacros() {
   List<String> result = scanner.listMacros();
   assertEquals(Lists.newArrayList(MACRO_NAME), result);
 }
 @Test
 public void findGroovyMacros() {
   Set<IMacro> macros = scanner.findGroovyMacros();
   IMacro macro = macros.iterator().next();
   assertEquals(MACRO_CLASS_NAME, macro.getClass().getName());
 }
 @Test
 public void verifyMacroBad() {
   assertFalse(scanner.verifyMacro("xyz").isEmpty()); // $NON-NLS-1$
   assertFalse(scanner.verifyMacro("class Xyz {}").isEmpty()); // $NON-NLS-1$
   assertFalse(scanner.verifyMacro("@Macro\nclass Xyz {}").isEmpty()); // $NON-NLS-1$
 }