void (final String expectedMessage) { String name = getTestName(false); @NonNls String fileName = "/refactoring/inlineToAnonymousClass/" + name + ".java"; configureByFile(fileName); PsiElement element = TargetElementUtil .findTargetElement(getEditor(), TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED); assertInstanceOf(element, PsiClass.class); String message = InlineToAnonymousClassHandler.getCannotInlineMessage((PsiClass) element); assertEquals(expectedMessage, message); }