mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
Add check for merged file to unit test
This commit is contained in:
@@ -64,10 +64,15 @@ public class GitMergeCommandTest extends AbstractGitCommandTestBase {
|
|||||||
assertThat(mergeCommandResult.isSuccess()).isTrue();
|
assertThat(mergeCommandResult.isSuccess()).isTrue();
|
||||||
|
|
||||||
Repository repository = createContext().open();
|
Repository repository = createContext().open();
|
||||||
Iterable<RevCommit> mergeCommit = new Git(repository).log().add(repository.resolve("master")).setMaxCount(1).call();
|
Iterable<RevCommit> commits = new Git(repository).log().add(repository.resolve("master")).setMaxCount(1).call();
|
||||||
PersonIdent mergeAuthor = mergeCommit.iterator().next().getAuthorIdent();
|
RevCommit mergeCommit = commits.iterator().next();
|
||||||
|
PersonIdent mergeAuthor = mergeCommit.getAuthorIdent();
|
||||||
assertThat(mergeAuthor.getName()).isEqualTo("Dirk Gently");
|
assertThat(mergeAuthor.getName()).isEqualTo("Dirk Gently");
|
||||||
assertThat(mergeAuthor.getEmailAddress()).isEqualTo("dirk@holistic.det");
|
assertThat(mergeAuthor.getEmailAddress()).isEqualTo("dirk@holistic.det");
|
||||||
|
// We expect the merge result of file b.txt here by looking up the sha hash of its content.
|
||||||
|
// If the file is missing (aka not merged correctly) this will throw a MissingObjectException:
|
||||||
|
byte[] contentOfFileB = repository.open(repository.resolve("9513e9c76e73f3e562fd8e4c909d0607113c77c6")).getBytes();
|
||||||
|
assertThat(new String(contentOfFileB)).isEqualTo("b\ncontent from branch\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user