use of org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo in project che by eclipse.
the class RenamePresenterTest method wizardShouldNotBeShowIfRenameRefactoringObjectWasNotCreated.
@Test
public void wizardShouldNotBeShowIfRenameRefactoringObjectWasNotCreated() throws Exception {
RefactorInfo refactorInfo = RefactorInfo.of(MoveType.REFACTOR_MENU, RefactoredItemType.COMPILATION_UNIT, new Resource[] { file });
renamePresenter.show(refactorInfo);
verify(createRenameRefactoringDto).setRefactorLightweight(false);
verify(createRenameRefactoringDto).setPath(anyString());
verify(createRenameRefactoringDto).setType(COMPILATION_UNIT);
verify(createRenameRefactoringDto).setProjectPath(eq("/project"));
verify(refactorService).createRenameRefactoring(createRenameRefactoringDto);
verify(renameRefactoringSessionPromise).catchError(promiseErrorCaptor.capture());
promiseErrorCaptor.getValue().apply(promiseError);
verify(notificationManager).notify(anyString(), anyString(), any(StatusNotification.Status.class), any(DisplayMode.class));
}
use of org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo in project che by eclipse.
the class RenamePresenterTest method changesShouldBeAppliedWithOkStatus.
@Test
public void changesShouldBeAppliedWithOkStatus() throws Exception {
RefactorInfo refactorInfo = RefactorInfo.of(MoveType.REFACTOR_MENU, RefactoredItemType.COMPILATION_UNIT, new Resource[] { file });
List<ChangeInfo> changes = new ArrayList<>();
when(refactoringStatus.getChanges()).thenReturn(changes);
when(changeCreationResult.isCanShowPreviewPage()).thenReturn(true);
when(refactoringStatus.getSeverity()).thenReturn(0);
renamePresenter.show(refactorInfo);
verify(refactorService).createRenameRefactoring(createRenameRefactoringDto);
verify(renameRefactoringSessionPromise).then(renameRefactoringSessionCaptor.capture());
renameRefactoringSessionCaptor.getValue().apply(session);
renamePresenter.onAcceptButtonClicked();
verify(refactoringSession).setSessionId(SESSION_ID);
verifyPreparingRenameSettingsDto();
verifyPreparingRenameChanges();
verify(changeCreationResultPromise).then(changeCreationResultCaptor.capture());
changeCreationResultCaptor.getValue().apply(changeCreationResult);
verify(refactorService).applyRefactoring(refactoringSession);
verify(refactoringStatusPromise).then(refactoringStatusCaptor.capture());
refactoringStatusCaptor.getValue().apply(refactoringStatus);
verify(refactoringStatus, times(2)).getSeverity();
verify(view).hide();
verify(refactoringUpdater).updateAfterRefactoring(changes);
}
use of org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo in project che by eclipse.
the class RenamePresenterTest method renameCompilationUnitWizardShouldBeShowCompilationUnit.
@Test
public void renameCompilationUnitWizardShouldBeShowCompilationUnit() throws Exception {
when(session.getWizardType()).thenReturn(RenameRefactoringSession.RenameWizard.COMPILATION_UNIT);
RefactorInfo refactorInfo = RefactorInfo.of(MoveType.REFACTOR_MENU, RefactoredItemType.COMPILATION_UNIT, new Resource[] { file });
renamePresenter.show(refactorInfo);
verifyPreparingRenameRefactoringDto();
verify(refactorService).createRenameRefactoring(createRenameRefactoringDto);
verify(renameRefactoringSessionPromise).then(renameRefactoringSessionCaptor.capture());
renameRefactoringSessionCaptor.getValue().apply(session);
verifyPreparingWizard();
verify(locale).renameCompilationUnitTitle();
verify(view).setTitle(anyString());
verify(view).setVisiblePatternsPanel(true);
verify(view).setVisibleFullQualifiedNamePanel(true);
verify(view).setVisibleSimilarlyVariablesPanel(true);
verify(view).show();
}
use of org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo in project che by eclipse.
the class RenamePresenterTest method renameLocalVariableWizardShouldBeShow.
@Test
public void renameLocalVariableWizardShouldBeShow() throws Exception {
RefactorInfo refactorInfo = RefactorInfo.of(MoveType.REFACTOR_MENU, RefactoredItemType.COMPILATION_UNIT, new Resource[] { file });
renamePresenter.show(refactorInfo);
verifyPreparingRenameRefactoringDto();
verify(refactorService).createRenameRefactoring(createRenameRefactoringDto);
verify(renameRefactoringSessionPromise).then(renameRefactoringSessionCaptor.capture());
renameRefactoringSessionCaptor.getValue().apply(session);
verifyPreparingWizard();
verify(locale).renameLocalVariableTitle();
verify(view).setTitle(anyString());
verify(view).show();
}
use of org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo in project che by eclipse.
the class RenamePresenterTest method renameTypeParameterWizardShouldBeShow.
@Test
public void renameTypeParameterWizardShouldBeShow() throws Exception {
when(session.getWizardType()).thenReturn(RenameRefactoringSession.RenameWizard.TYPE_PARAMETER);
RefactorInfo refactorInfo = RefactorInfo.of(MoveType.REFACTOR_MENU, RefactoredItemType.COMPILATION_UNIT, new Resource[] { file });
renamePresenter.show(refactorInfo);
verifyPreparingRenameRefactoringDto();
verify(refactorService).createRenameRefactoring(createRenameRefactoringDto);
verify(renameRefactoringSessionPromise).then(renameRefactoringSessionCaptor.capture());
renameRefactoringSessionCaptor.getValue().apply(session);
verifyPreparingWizard();
verify(locale).renameTypeVariableTitle();
verify(view).setTitle(anyString());
verify(view).show();
}
Aggregations