void () { FileTemplateManagerImpl templateManager = (FileTemplateManagerImpl)FileTemplateManager.getInstance(getProject()); templateManager.getState().recentTemplates.clear(); FileTemplate[] before = templateManager.getAllTemplates(); try { for (int i = 0; i < 30; i++) { templateManager.addTemplate("foo" + i, "java"); } DataContext context = SimpleDataContext.getProjectContext(myFixture.getProject()); AnActionEvent event = AnActionEvent.createFromDataContext(ActionPlaces.UNKNOWN, null, context); AnAction[] children = new CreateFromTemplateGroup().getChildren(event); assertEquals(3, children.length); assertEquals(IdeBundle.message("action.from.file.template"), children[0].getTemplatePresentation().getText()); } finally { templateManager.setTemplates(FileTemplateManager.DEFAULT_TEMPLATES_CATEGORY, Arrays.asList(before)); templateManager.getState().recentTemplates.clear(); } }