use of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change in project egit by eclipse.
the class ChangeTest method shouldNotBeEqualWithNullRefference.
@Test
public void shouldNotBeEqualWithNullRefference() {
// given
Change change = new Change();
// when
boolean result = change.equals(null);
// then
assertFalse(result);
}
use of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change in project egit by eclipse.
the class ChangeTest method shouldBeEqualWhenBothObjectIdsAndRemoteIdsAreSame.
@Test
public void shouldBeEqualWhenBothObjectIdsAndRemoteIdsAreSame() {
// given
Change c1 = new Change();
Change c2 = new Change();
c1.objectId = c2.objectId = ZERO_ID;
c1.remoteObjectId = c2.remoteObjectId = MISC_ID;
// when
boolean result = c1.equals(c2);
// then
assertTrue(result);
assertEquals(c1.hashCode(), c2.hashCode());
}
use of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change in project egit by eclipse.
the class StagedChangeCacheTest method shouldListTwoWorkspaceAdditions.
@Test
public void shouldListTwoWorkspaceAdditions() throws Exception {
// given
writeTrashFile(db, "a.txt", "trash");
writeTrashFile(db, "b.txt", "trash");
try (Git git = new Git(db)) {
git.add().addFilepattern("a.txt").addFilepattern("b.txt").call();
}
// when
Map<String, Change> result = StagedChangeCache.build(db);
// then
assertThat(result.size(), is(2));
assertFileAddition(result, "a.txt", "a.txt");
assertFileAddition(result, "b.txt", "b.txt");
}
use of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change in project egit by eclipse.
the class StagedChangeCacheTest method shouldListSingleWorkspaceChangeInFolder.
@Test
public void shouldListSingleWorkspaceChangeInFolder() throws Exception {
// given
try (Git git = new Git(db)) {
writeTrashFile(db, "folder/a.txt", "trash");
git.add().addFilepattern("folder/a.txt").call();
git.commit().setMessage("new commit").call();
writeTrashFile(db, "folder/a.txt", "modification");
git.add().addFilepattern("folder/a.txt").call();
}
// when
Map<String, Change> result = StagedChangeCache.build(db);
// then
assertThat(result.size(), is(1));
assertFileChange(result, "folder/a.txt", "a.txt");
}
use of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change in project egit by eclipse.
the class StagedChangeCacheTest method shouldListTwoWorkspaceChagneInFolder.
@Test
public void shouldListTwoWorkspaceChagneInFolder() throws Exception {
// given
try (Git git = new Git(db)) {
writeTrashFile(db, "folder/a.txt", "trash");
writeTrashFile(db, "folder/b.txt", "trash");
git.add().addFilepattern("folder/a.txt").addFilepattern("folder/b.txt").call();
git.commit().setMessage("new commit").call();
writeTrashFile(db, "folder/a.txt", "modification");
writeTrashFile(db, "folder/b.txt", "modification");
git.add().addFilepattern("folder/a.txt").addFilepattern("folder/b.txt").call();
}
// when
Map<String, Change> result = StagedChangeCache.build(db);
// then
assertThat(result.size(), is(2));
assertFileChange(result, "folder/a.txt", "a.txt");
assertFileChange(result, "folder/b.txt", "b.txt");
}
Aggregations