Search in sources :

Example 1 with CommitEditorInputFactory

use of org.eclipse.egit.ui.internal.commit.CommitEditorInputFactory in project egit by eclipse.

the class CommitEditorInputFactoryTest method shouldPersistAndRestoreCommit.

@Test
public void shouldPersistAndRestoreCommit() {
    RepositoryCommit repositoryCommit = new RepositoryCommit(repository, commit);
    new CommitEditorInput(repositoryCommit).saveState(memento);
    IAdaptable restored = new CommitEditorInputFactory().createElement(memento);
    assertNotNull(restored);
    assertThat(restored, instanceOf(CommitEditorInput.class));
    assertThat(repositoryCommit, isSameCommit(((CommitEditorInput) restored).getCommit()));
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) CommitEditorInputFactory(org.eclipse.egit.ui.internal.commit.CommitEditorInputFactory) CommitEditorInput(org.eclipse.egit.ui.internal.commit.CommitEditorInput) RepositoryCommit(org.eclipse.egit.ui.internal.commit.RepositoryCommit) Test(org.junit.Test)

Example 2 with CommitEditorInputFactory

use of org.eclipse.egit.ui.internal.commit.CommitEditorInputFactory in project egit by eclipse.

the class CommitEditorInputFactoryTest method shouldPersistAndRestoreStashCommit.

@Test
public void shouldPersistAndRestoreStashCommit() {
    RepositoryCommit stashCommit = new RepositoryCommit(repository, commit);
    stashCommit.setStash(true);
    new CommitEditorInput(stashCommit).saveState(memento);
    IAdaptable restored = new CommitEditorInputFactory().createElement(memento);
    assertNotNull(restored);
    assertThat(restored, instanceOf(CommitEditorInput.class));
    assertThat(stashCommit, isSameCommit(((CommitEditorInput) restored).getCommit()));
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) CommitEditorInputFactory(org.eclipse.egit.ui.internal.commit.CommitEditorInputFactory) CommitEditorInput(org.eclipse.egit.ui.internal.commit.CommitEditorInput) RepositoryCommit(org.eclipse.egit.ui.internal.commit.RepositoryCommit) Test(org.junit.Test)

Aggregations

IAdaptable (org.eclipse.core.runtime.IAdaptable)2 CommitEditorInput (org.eclipse.egit.ui.internal.commit.CommitEditorInput)2 CommitEditorInputFactory (org.eclipse.egit.ui.internal.commit.CommitEditorInputFactory)2 RepositoryCommit (org.eclipse.egit.ui.internal.commit.RepositoryCommit)2 Test (org.junit.Test)2