Search in sources :

Example 6 with RefactorInfo

use of org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo in project che by eclipse.

the class RenamePresenterTest method renameFieldWizardShouldBeShow.

@Test
public void renameFieldWizardShouldBeShow() throws Exception {
    when(session.getWizardType()).thenReturn(RenameRefactoringSession.RenameWizard.FIELD);
    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).renameFieldTitle();
    verify(view).setTitle(anyString());
    verify(view).setVisiblePatternsPanel(true);
    verify(view).show();
}
Also used : RefactorInfo(org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo) Test(org.junit.Test)

Example 7 with RefactorInfo

use of org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo in project che by eclipse.

the class RenamePresenterTest method changesShouldBeAppliedWithNotErrorStatus.

@Test
public void changesShouldBeAppliedWithNotErrorStatus() throws Exception {
    RefactorInfo refactorInfo = RefactorInfo.of(MoveType.REFACTOR_MENU, RefactoredItemType.COMPILATION_UNIT, new Resource[] { file });
    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(view).hide();
    verify(refactoringUpdater).updateAfterRefactoring(Matchers.<List<ChangeInfo>>anyObject());
}
Also used : ChangeInfo(org.eclipse.che.ide.ext.java.shared.dto.refactoring.ChangeInfo) RefactorInfo(org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo) Test(org.junit.Test)

Example 8 with RefactorInfo

use of org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo in project che by eclipse.

the class RenamePresenterTest method renameMethodWizardShouldBeShow.

@Test
public void renameMethodWizardShouldBeShow() throws Exception {
    when(session.getWizardType()).thenReturn(RenameRefactoringSession.RenameWizard.METHOD);
    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).renameMethodTitle();
    verify(view).setTitle(anyString());
    verify(view).setVisibleKeepOriginalPanel(true);
    verify(view).show();
}
Also used : RefactorInfo(org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo) Test(org.junit.Test)

Example 9 with RefactorInfo

use of org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo in project che by eclipse.

the class RenamePresenterTest method renamePackageWizardShouldBeShow.

@Test
public void renamePackageWizardShouldBeShow() throws Exception {
    when(session.getWizardType()).thenReturn(RenameRefactoringSession.RenameWizard.PACKAGE);
    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).renamePackageTitle();
    verify(view).setTitle(anyString());
    verify(view).setVisiblePatternsPanel(true);
    verify(view).setVisibleFullQualifiedNamePanel(true);
    verify(view).setVisibleRenameSubpackagesPanel(true);
    verify(view).show();
}
Also used : RefactorInfo(org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo) Test(org.junit.Test)

Example 10 with RefactorInfo

use of org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo in project che by eclipse.

the class RenamePresenterTest method renameEnumConstantWizardShouldBeShow.

@Test
public void renameEnumConstantWizardShouldBeShow() throws Exception {
    when(session.getWizardType()).thenReturn(RenameRefactoringSession.RenameWizard.ENUM_CONSTANT);
    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).renameEnumTitle();
    verify(view).setTitle(anyString());
    verify(view).setVisiblePatternsPanel(true);
    verify(view).show();
}
Also used : RefactorInfo(org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo) Test(org.junit.Test)

Aggregations

RefactorInfo (org.eclipse.che.ide.ext.java.client.refactoring.RefactorInfo)11 Test (org.junit.Test)11 ChangeInfo (org.eclipse.che.ide.ext.java.shared.dto.refactoring.ChangeInfo)2 ArrayList (java.util.ArrayList)1 DisplayMode (org.eclipse.che.ide.api.notification.StatusNotification.DisplayMode)1 RefactoringStatus (org.eclipse.che.ide.ext.java.shared.dto.refactoring.RefactoringStatus)1