use of org.eclipse.che.api.git.shared.Status in project che by eclipse.
the class JGitConnectionTest method testCommitNotChangedSpecifiedPathsWithAmendAndWithAllWhenOtherUnstagedChangesArePresent.
/** Test for workaround related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=510685.*/
@Test(expectedExceptions = GitException.class, expectedExceptionsMessageRegExp = "Changes are present but not changed path was specified for commit.")
public void testCommitNotChangedSpecifiedPathsWithAmendAndWithAllWhenOtherUnstagedChangesArePresent() throws Exception {
//given
Status status = mock(Status.class);
when(status.getModified()).thenReturn(singletonList("ChangedNotSpecified"));
doReturn(status).when(jGitConnection).status(anyObject());
//when
jGitConnection.commit(CommitParams.create("message").withFiles(singletonList("NotChangedSpecified")).withAmend(true).withAll(true));
}
use of org.eclipse.che.api.git.shared.Status in project che by eclipse.
the class JGitConnectionTest method testCommitNotChangedSpecifiedPathsWithAmendWhenOtherStagedChangesArePresent.
/** Test for workaround related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=510685.*/
@Test(expectedExceptions = GitException.class, expectedExceptionsMessageRegExp = "Changes are present but not changed path was specified for commit.")
public void testCommitNotChangedSpecifiedPathsWithAmendWhenOtherStagedChangesArePresent() throws Exception {
//given
Status status = mock(Status.class);
when(status.getChanged()).thenReturn(singletonList("ChangedNotSpecified"));
doReturn(status).when(jGitConnection).status(anyObject());
//when
jGitConnection.commit(CommitParams.create("message").withFiles(singletonList("NotChangedSpecified")).withAmend(true));
}
use of org.eclipse.che.api.git.shared.Status in project che by eclipse.
the class ResetFilesPresenterTest method testOnResetClickedWhenResetRequestIsSuccessful.
@Test
public void testOnResetClickedWhenResetRequestIsSuccessful() throws Exception {
final Status status = mock(Status.class);
List<String> changes = new ArrayList<String>();
changes.add("Change");
when(status.getAdded()).thenReturn(changes);
when(status.getChanged()).thenReturn(changes);
when(status.getRemoved()).thenReturn(changes);
when(service.reset(anyObject(), any(Path.class), anyString(), any(ResetRequest.ResetType.class), anyObject())).thenReturn(voidPromise);
when(voidPromise.then(any(Operation.class))).thenReturn(voidPromise);
when(voidPromise.catchError(any(Operation.class))).thenReturn(voidPromise);
presenter.showDialog(project);
verify(statusPromise).then(statusPromiseCaptor.capture());
statusPromiseCaptor.getValue().apply(status);
presenter.onResetClicked();
verify(voidPromise).then(voidPromiseCaptor.capture());
voidPromiseCaptor.getValue().apply(null);
verify(view).close();
verify(notificationManager).notify(anyString());
verify(console).print(anyString());
verify(constant, times(2)).resetFilesSuccessfully();
}
use of org.eclipse.che.api.git.shared.Status in project che by eclipse.
the class ResetFilesPresenterTest method testShowDialogWhenStatusRequestIsSuccessfulButIndexIsEmpty.
@Test
public void testShowDialogWhenStatusRequestIsSuccessfulButIndexIsEmpty() throws Exception {
MessageDialog messageDialog = mock(MessageDialog.class);
when(constant.messagesWarningTitle()).thenReturn("Warning");
when(constant.indexIsEmpty()).thenReturn("Index is Empty");
when(dialogFactory.createMessageDialog(anyString(), anyString(), anyObject())).thenReturn(messageDialog);
final Status status = mock(Status.class);
List<String> changes = new ArrayList<>();
when(status.getAdded()).thenReturn(changes);
when(status.getChanged()).thenReturn(changes);
when(status.getRemoved()).thenReturn(changes);
presenter.showDialog(project);
verify(statusPromise).then(statusPromiseCaptor.capture());
statusPromiseCaptor.getValue().apply(status);
verify(dialogFactory).createMessageDialog(eq("Warning"), eq("Index is Empty"), anyObject());
verify(view, never()).setIndexedFiles(anyObject());
verify(view, never()).showDialog();
}
Aggregations