void (final boolean createNewBuilderClass, final Map<String, String> expectedDefaults, final String conflicts, final String packageName) { doTest(() -> { final PsiClass aClass = myFixture.findClass("Test"); final LinkedHashMap<String, ParameterData> map = new LinkedHashMap<>(); final PsiMethod[] constructors = aClass.getConstructors(); for (PsiMethod constructor : constructors) { ParameterData.createFromConstructor(constructor, "set", map); } if (expectedDefaults != null) { for (Map.Entry<String, String> entry : expectedDefaults.entrySet()) { final ParameterData parameterData = map.get(entry.getKey()); assertNotNull(parameterData); assertEquals(entry.getValue(), parameterData.getDefaultValue()); } } try { new ReplaceConstructorWithBuilderProcessor(getProject(), constructors, map, "Builder", packageName, null, createNewBuilderClass).run(); if (conflicts != null) { fail("Conflicts were not detected:" + conflicts); } } catch (BaseRefactoringProcessor.ConflictsInTestsException e) { if (conflicts == null) { fail("Conflict detected:" + e.getMessage()); } } }); }