use of com.jetbrains.lang.dart.ide.refactoring.ServerInlineLocalRefactoring in project intellij-plugins by JetBrains.
the class DartInlineLocalRefactoringTest method createInlineLocalRefactoring.
@NotNull
private ServerInlineLocalRefactoring createInlineLocalRefactoring(String filePath) {
((CodeInsightTestFixtureImpl) myFixture).canChangeDocumentDuringHighlighting(true);
final PsiFile psiFile = myFixture.configureByFile(filePath);
// make sure server is warmed up
myFixture.doHighlighting();
// find the Element to rename
final int offset = getEditor().getCaretModel().getOffset();
return new ServerInlineLocalRefactoring(getProject(), psiFile.getVirtualFile(), offset, 0);
}
use of com.jetbrains.lang.dart.ide.refactoring.ServerInlineLocalRefactoring in project intellij-plugins by JetBrains.
the class DartInlineLocalRefactoringTest method doTest.
private void doTest(String filePath) {
final ServerInlineLocalRefactoring refactoring = createInlineLocalRefactoring(filePath);
// check initial conditions
final RefactoringStatus initialConditions = refactoring.checkInitialConditions();
assertNotNull(initialConditions);
assertTrue(initialConditions.isOK());
// check final conditions
final RefactoringStatus finalConditions = refactoring.checkFinalConditions();
assertNotNull(finalConditions);
assertTrue(finalConditions.isOK());
// apply the SourceChange
final SourceChange change = refactoring.getChange();
assertNotNull(change);
ApplicationManager.getApplication().runWriteAction(() -> {
try {
AssistUtils.applySourceChange(myFixture.getProject(), change, false);
} catch (DartSourceEditException e) {
fail(e.getMessage());
}
});
// validate
myFixture.checkResultByFile(getTestName(false) + ".after.dart");
}
Aggregations