void (final TemplateResource templateResource) { configureByFile("/codeInsight/generateToString/before" + getTestName(false) + ".java"); final Editor editor = getEditor(); final PsiElement elementAt = getFile().findElementAt(editor.getCaretModel().getOffset()); final PsiClass clazz = PsiTreeUtil.getParentOfType(elementAt, PsiClass.class); assertNotNull(clazz); WriteAction.run(() -> { final GenerateToStringWorker worker = new GenerateToStringWorker(clazz, editor, false); worker.execute(Collections.emptyList(), templateResource, ReplacePolicy.getInstance()); }); checkResultByFile("/codeInsight/generateToString/after" + getTestName(false) + ".java"); }