TemplateImpl (String key) { TemplateManager manager = TemplateManager.getInstance(getProject()); TemplateImpl template = (TemplateImpl)manager.createTemplate(key, "user", ""); TemplateContextType contextType = TemplateContextTypes.getByClass(JavaCodeContextType.Generic.class); template.getTemplateContext().setEnabled(contextType, true); CodeInsightTestUtil.addTemplate(template, myFixture.getTestRootDisposable()); return template; }