RevCommit headCommit = TestUtil.getHeadCommit(repository);
ObjectId headCommitId = headCommit.getId();
String changeId = CommitMessageUtil.extractChangeId(headCommit
.getFullMessage());
setContent("Changes over changes");
StagingViewTester stagingViewTester = StagingViewTester
.openStagingView();
stagingViewTester.stageFile(FILE1_PATH);
stagingViewTester.setAmend(true);
assertTrue(stagingViewTester.getCommitMessage().indexOf("Change-Id") > 0);
assertTrue(stagingViewTester.getCommitMessage()
.indexOf("Signed-off-by") > 0);
assertTrue(stagingViewTester.getSignedOff());
assertTrue(stagingViewTester.getInsertChangeId());
stagingViewTester.commit();
headCommit = TestUtil.getHeadCommit(repository);
if (headCommitId.equals(headCommit.getId()))
fail("There is no new commit");
assertEquals(oldHeadCommit, headCommit.getParent(0));
assertTrue(headCommit.getFullMessage().indexOf(changeId) > 0);