void (@NotNull String pattern, @NotNull Runnable runnable) { TodoConfiguration todoConfiguration = TodoConfiguration.getInstance(); TodoPattern[] originalPatterns = todoConfiguration.getTodoPatterns(); try { TodoPattern todoPattern = new TodoPattern(pattern, new TodoAttributes(new TextAttributes()), false); todoConfiguration.setTodoPatterns(new TodoPattern[]{todoPattern}); PlatformTestUtil.dispatchAllEventsInIdeEventQueue(); runnable.run(); } finally { todoConfiguration.setTodoPatterns(originalPatterns); PlatformTestUtil.dispatchAllEventsInIdeEventQueue(); } }