void () { final CacheManager cache = CacheManager.getInstance(myProject); final TodoCacheManager todocache = TodoCacheManager.getInstance(myProject); checkCache(cache, todocache); VirtualFile child = myRootDir.findChild("1.java"); checkCache(cache, todocache); setFileText(child, "xxx"); setFileText(child, "xxx"); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); final GlobalSearchScope scope = GlobalSearchScope.projectScope(myProject); checkResult(new String[] {"1.java"}, convert(cache.getFilesWithWord("xxx", UsageSearchContext.ANY, scope, false))); checkResult(new String[]{}, convert(cache.getFilesWithWord("a", UsageSearchContext.ANY, scope, false))); checkResult(new String[]{"2.java"}, convert(cache.getFilesWithWord("b", UsageSearchContext.ANY, scope, false))); checkResult(new String[]{"2.java", "3.java"}, convert(cache.getFilesWithWord("c", UsageSearchContext.ANY, scope, false))); checkResult(new String[]{"2.java", "3.java"}, convert(cache.getFilesWithWord("d", UsageSearchContext.ANY, scope, false))); checkResult(new String[]{"3.java"}, convert(cache.getFilesWithWord("e", UsageSearchContext.ANY, scope, false))); checkResult(new String[]{"3.java"}, convert(getFilesWithTodoItems(todocache))); assertEquals(0, todocache.getTodoCount(myRootDir.findChild("1.java"), TodoIndexPatternProvider.getInstance())); assertEquals(0, todocache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance())); assertEquals(2, todocache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance())); }