Source:
public void testDelete() throws Exception { env.setCtags(System.getProperty(ctagsProperty, "ctags")); assertTrue("No point in running indexer tests without valid ctags", RuntimeEnvironment.getInstance().validateExuberantCtags()); Message m = new ProjectMessage(); m.setText("add"); m.addTag("mercurial"); m.addTag("git"); m.addTag("svn"); Assert.assertEquals(0, env.getProjects().size()); Assert.assertEquals(0, env.getRepositories().size()); Assert.assertEquals(0, env.getProjectRepositoriesMap().size()); m.apply(env); Assert.assertEquals(3, env.getProjects().size()); Assert.assertEquals(3, env.getRepositories().size()); Assert.assertEquals(3, env.getProjectRepositoriesMap().size()); ArrayList<String> subFiles = new ArrayList<>(); subFiles.add("/git"); subFiles.add("/mercurial"); subFiles.add("/git"); ArrayList<String> repos = new ArrayList<>(); repos.add("/git"); repos.add("/mercurial"); repos.add("/svn"); HistoryGuru.getInstance().invalidateRepositories( env.getRepositories()); Indexer.getInstance().prepareIndexer( env, false, false, null, null, true, false, false, subFiles, repos, new ArrayList<>(), false); Indexer.getInstance().doIndexerExecution(true, 1, null, null); m.setText("delete"); m.setTags(new TreeSet<String>()); m.addTag("git"); m.addTag("svn"); m.apply(env); Assert.assertEquals(1, env.getProjects().size()); Assert.assertEquals(1, env.getRepositories().size()); Assert.assertEquals(1, env.getProjectRepositoriesMap().size()); File dataRoot = env.getDataRootFile(); for (String projectName : new String[]{"git", "svn"}) { for (String dirName : new String[]{"historycache", IndexDatabase.XREF_DIR, IndexDatabase.INDEX_DIR}) { File dir = new File(env.getDataRootFile(), dirName + File.separator + projectName); Assert.assertFalse(dir.exists()); } } }

Target:
public void testDelete() throws Exception { env.setCtags(System.getProperty(ctagsProperty, "ctags")); assertTrue("No point in running indexer tests without valid ctags", RuntimeEnvironment.getInstance().validateExuberantCtags()); Message m = new ProjectMessage(); m.setText("add"); m.addTag("mercurial"); m.addTag("git"); m.addTag("svn"); Assert.assertEquals(0, env.getProjects().size()); Assert.assertEquals(0, env.getRepositories().size()); Assert.assertEquals(0, env.getProjectRepositoriesMap().size()); m.apply(env); Assert.assertEquals(3, env.getProjects().size()); Assert.assertEquals(3, env.getRepositories().size()); Assert.assertEquals(3, env.getProjectRepositoriesMap().size()); ArrayList<String> subFiles = new ArrayList<>(); subFiles.add("/git"); subFiles.add("/mercurial"); subFiles.add("/svn"); ArrayList<String> repos = new ArrayList<>(); repos.add("/git"); repos.add("/mercurial"); repos.add("/svn"); HistoryGuru.getInstance().invalidateRepositories( env.getRepositories()); env.setHistoryEnabled(true); Indexer.getInstance().prepareIndexer( env, false, false, null, false, false, subFiles, repos, new ArrayList<>(), false); Indexer.getInstance().doIndexerExecution(true, 1, null, null); m.setText("delete"); m.setTags(new TreeSet<String>()); m.addTag("git"); m.addTag("svn"); m.apply(env); Assert.assertEquals(1, env.getProjects().size()); Assert.assertEquals(1, env.getRepositories().size()); Assert.assertEquals(1, env.getProjectRepositoriesMap().size()); File dataRoot = env.getDataRootFile(); for (String projectName : new String[]{"git", "svn"}) { for (String dirName : new String[]{"historycache", IndexDatabase.XREF_DIR, IndexDatabase.INDEX_DIR}) { File dir = new File(env.getDataRootFile(), dirName + File.separator + projectName); Assert.assertFalse(dir.exists()); } } }