void () { TodoPattern pattern = new TodoPattern("newtodo", TodoAttributesUtil.createDefault(), true); TodoPattern[] oldPatterns = TodoConfiguration.getInstance().getTodoPatterns(); TodoConfiguration.getInstance().setTodoPatterns(new TodoPattern[]{pattern}); PlatformTestUtil.dispatchAllEventsInIdeEventQueue(); try{ final TodoCacheManager todocache = TodoCacheManager.getInstance(myProject); checkResult(new String[]{"2.java"}, convert(getFilesWithTodoItems(todocache))); assertEquals(0, todocache.getTodoCount(myRootDir.findChild("1.java"), TodoIndexPatternProvider.getInstance())); assertEquals(1, todocache.getTodoCount(myRootDir.findChild("2.java"), TodoIndexPatternProvider.getInstance())); assertEquals(0, todocache.getTodoCount(myRootDir.findChild("3.java"), TodoIndexPatternProvider.getInstance())); } finally{ TodoConfiguration.getInstance().setTodoPatterns(oldPatterns); } }