void (final boolean shouldSucceed) { final String filePath = getTestFilePath(); configureByFile(filePath); final PsiElement targetElement = TargetElementUtil.findTargetElement(getEditor(), TargetElementUtil.ELEMENT_NAME_ACCEPTED); assertTrue("<caret> is not on method name", targetElement instanceof PsiMember); final PsiMember psiMethod = (PsiMember)targetElement; assertSame(TestDialog.DEFAULT, TestDialogManager.getTestImplementation()); try { MethodDuplicatesHandler.invokeOnScope(getProject(), psiMethod, new AnalysisScope(getFile())); UIUtil.dispatchAllInvocationEvents(); } catch (RuntimeException e) { if (shouldSucceed) { fail("duplicates were not found"); } return; } if (shouldSucceed) { checkResultByFile(filePath + ".after"); } else { fail("duplicates found" + "; file content: " + getFile().getText()); } }