void () { myFixture.configureByText("Test.java", """ class Test { public String <caret>foo() { return "xyz"; } } """); PsiMethod method = ((PsiJavaFile)getFile()).getClasses()[0].getMethods()[0]; ExternalAnnotationsManager.getInstance(getProject()).annotateExternally(method, CommonClassNames.JAVA_LANG_OVERRIDE, getFile(), null); ExternalAnnotationsManager.getInstance(getProject()).annotateExternally(method, CommonClassNames.JAVA_LANG_SAFE_VARARGS, getFile(), null); IntentionAction action = myFixture.findSingleIntention("Deannotate"); assertEquals(""" <root> <item name='Test java.lang.String foo()'> <annotation name='java.lang.SafeVarargs'/> </item> </root>""", myFixture.getIntentionPreviewText(action)); }