public void testAmendWithChangeIdPreferenceOff() throws Exception {
Repository repo = lookupRepository(repositoryFile);
repo.getConfig().setBoolean(ConfigConstants.CONFIG_GERRIT_SECTION,
null, ConfigConstants.CONFIG_KEY_CREATECHANGEID, true);
setTestFileContent("Another Change");
CommitDialogTester commitDialogTester = CommitDialogTester
.openCommitDialog(PROJ1);
assertEquals("Wrong row count", 1, commitDialogTester.getRowCount());
assertTrue("Wrong file",
commitDialogTester.getEntryText(0).endsWith("test.txt"));
commitDialogTester.setAuthor(TestUtil.TESTAUTHOR);
commitDialogTester.setCommitter(TestUtil.TESTCOMMITTER);
String commitMessage = commitDialogTester.getCommitMessage();
assertTrue(commitMessage.indexOf("Change-Id") > 0);
String newCommitMessage = "Change to be amended \n\n" + commitMessage;
commitDialogTester.setCommitMessage(newCommitMessage);
commitDialogTester.commit();
NoFilesToCommitPopup noFilesToCommitPopup = CommitDialogTester
.openCommitDialogExpectNoFilesToCommit(PROJ1);
repo.getConfig().setBoolean(ConfigConstants.CONFIG_GERRIT_SECTION,
null, ConfigConstants.CONFIG_KEY_CREATECHANGEID, false);
commitDialogTester = noFilesToCommitPopup.confirmPopup();
assertTrue(commitDialogTester.getCommitMessage().indexOf("Change-Id") > 0);
}