void () { final PsiElementFactory factory = getFactory(); final PsiMethod method = factory.createMethodFromText( """ /** * Javadoc * @param p1 * @param p2 */ void m() {}""", null); final PsiDocComment docComment = method.getDocComment(); assertNotNull(docComment); final PsiDocTag[] tags = docComment.getTags(); WriteCommandAction.runWriteCommandAction(null, () -> tags[0].delete()); assertEquals(""" /** * Javadoc * @param p2 */""", docComment.getText()); }