void () { final Template template = TemplateManager.getInstance(getProject()).createTemplate("foo", "zzz"); template.addTextSegment("FooFactory.createFoo()"); SmartCompletionContextType completionContextType = TemplateContextTypes.getByClass(SmartCompletionContextType.class); ((TemplateImpl)template).getTemplateContext().setEnabled(completionContextType, true); CodeInsightTestUtil.addTemplate(template, myFixture.getTestRootDisposable()); doTest(); }