use of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change in project egit by eclipse.
the class GitModelCacheFileTest method createCacheFile.
private GitModelCacheFile createCacheFile(ObjectId repoId, ObjectId cacheId, IPath location) throws Exception {
Change change = mock(Change.class);
when(change.getObjectId()).thenReturn(AbbreviatedObjectId.fromObjectId(cacheId));
when(change.getRemoteObjectId()).thenReturn(AbbreviatedObjectId.fromObjectId(repoId));
return new GitModelCacheFile(createModelCommit(), lookupRepository(leftRepoFile), change, location);
}
use of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change in project egit by eclipse.
the class ChangeTest method shouldBeEqualWhenBothObjectIdsAreTheSame.
@Test
public void shouldBeEqualWhenBothObjectIdsAreTheSame() {
// given
Change c1 = new Change();
Change c2 = new Change();
c1.objectId = c2.objectId = 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 ChangeTest method shouldNotBeEqualWhenObjectIdsAreDifferent.
@Test
public void shouldNotBeEqualWhenObjectIdsAreDifferent() {
// given
Change c1 = new Change();
Change c2 = new Change();
c1.objectId = ZERO_ID;
c2.objectId = MISC_ID;
// when
boolean result = c1.equals(c2);
// then
assertFalse(result);
assertFalse(c1.hashCode() == c2.hashCode());
}
use of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change in project egit by eclipse.
the class ChangeTest method shouldNotBeEqualWithDifferentType.
@Test
public void shouldNotBeEqualWithDifferentType() {
// given
Change change = new Change();
// when
boolean result = change.equals(new Object());
// then
assertFalse(result);
}
use of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change in project egit by eclipse.
the class ChangeTest method shouldNotBeEqualWhenOneObjectIdIsNull.
@Test
public void shouldNotBeEqualWhenOneObjectIdIsNull() {
// given
Change change = new Change();
change.objectId = ZERO_ID;
// when
boolean result = change.equals(new Change());
// then
assertFalse(result);
}
Aggregations