IntroduceVariableSettings (Project project, Editor editor, PsiExpression expr, PsiExpression[] occurrences, TypeSelectorManagerImpl typeSelectorManager, boolean declareFinalIfAll, boolean anyAssignmentLHS, InputValidator validator, PsiElement anchor, JavaReplaceChoice replaceChoice) { PsiType defaultType = typeSelectorManager.getDefaultType(); PsiType type = myLookForType ? findType(typeSelectorManager.getTypesForAll(), defaultType) : defaultType; assertEquals(myExpectedTypeText, type.getInternalCanonicalText()); boolean isDeclareVarType = canBeExtractedWithoutExplicitType(expr) && createVarType(); IntroduceVariableSettings introduceVariableSettings = new IntroduceVariableSettings() { @Override public @NlsSafe String getEnteredName() { return myName; } @Override public boolean isReplaceAllOccurrences() { return myReplaceAll && occurrences.length > 1; } @Override public boolean isDeclareFinal() { return myDeclareFinal || isReplaceAllOccurrences() && declareFinalIfAll; } @Override public boolean isReplaceLValues() { return myReplaceLValues; } @Override public PsiType getSelectedType() { return type; } @Override public boolean isOK() { return true; } @Override public boolean isDeclareVarType() { return isDeclareVarType; } }; boolean validationResult = validator.isOK(introduceVariableSettings); assertValidationResult(validationResult); return introduceVariableSettings; }