void (String text, String extension) { configureFromFileText("test." + extension, text); if (!text.contains(EditorTestUtil.CARET_TAG)) { end(); } ApplicationManager.getApplication().runWriteAction(() -> { TemplateManager.getInstance(getProject()).startTemplate(getEditor(), TemplateSettings.TAB_CHAR); }); NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); UIUtil.dispatchAllInvocationEvents(); }