Template (String text, String expected) { PsiFile psiFile = myFixture.configureByText(JavaFileType.INSTANCE, text); TemplateBuilderImpl builder = (TemplateBuilderImpl)StructuralSearchTemplateBuilder.getInstance().buildTemplate(getFile()); Template template = WriteCommandAction.writeCommandAction(getProject()).compute(() -> { Template inlineTemplate = builder.buildInlineTemplate(); TemplateManager.getInstance(getProject()).startTemplate(getEditor(), inlineTemplate); return inlineTemplate; }); assertEquals(expected, psiFile.getText()); return template; }