void (MemberInfo[] members, String targetPackageName, PsiClass psiClass, String[] conflicts, Function<PsiDirectory, ExtractSuperBaseProcessor> createProcessor) { PsiDirectory targetDirectory; if (targetPackageName == null) { targetDirectory = psiClass.getContainingFile().getContainingDirectory(); } else { final PsiPackage aPackage = myFixture.findPackage(targetPackageName); assertNotNull(aPackage); targetDirectory = aPackage.getDirectories()[0]; } ExtractSuperBaseProcessor processor = createProcessor.apply(targetDirectory); final PsiPackage targetPackage; if (targetDirectory != null) { targetPackage = JavaDirectoryService.getInstance().getPackage(targetDirectory); } else { targetPackage = null; } final PsiClass superClass = psiClass.getExtendsListTypes().length > 0 ? psiClass.getSuperClass() : null; final MultiMap<PsiElement, String> conflictsMap = PullUpConflictsUtil.checkConflicts(members, psiClass, superClass, targetPackage, targetDirectory, psiMethod -> PullUpProcessor.checkedInterfacesContain(Arrays.asList(members), psiMethod), false); if (conflicts != null) { if (conflictsMap.isEmpty()) { fail("Conflicts were not detected"); } final HashSet<String> expectedConflicts = new HashSet<>(Arrays.asList(conflicts)); final HashSet<String> actualConflicts = new HashSet<>(conflictsMap.values()); assertEquals(actualConflicts.toString(), expectedConflicts.size(), actualConflicts.size()); for (String actualConflict : actualConflicts) { if (!expectedConflicts.contains(actualConflict)) { fail("Unexpected conflict: " + actualConflict); } } } else if (!conflictsMap.isEmpty()) { fail("Unexpected conflicts!!!" + conflictsMap.toString()); } processor.run(); }