void () { configureByFile(BASE_PATH + getTestName(false) + ".java"); PsiElementFactory factory = JavaPsiFacade.getElementFactory(getProject()); PsiMethod method = factory.createMethod("foo", PsiTypes.voidType()); int offset = getEditor().getCaretModel().getOffset(); List<GenerationInfo> list = Collections.singletonList(new PsiGenerationInfo<>(method)); List<GenerationInfo> members = WriteAction.compute(() -> GenerateMembersUtil.insertMembersAtOffset(getFile(), offset, list)); members.get(0).positionCaret(getEditor(), true); checkResultByFile(null, BASE_PATH + getTestName(false) + "_after.java", true); }