use of org.eclipse.che.api.git.params.CommitParams in project che by eclipse.
the class CommitTest method testChangeMessageOfLastCommit.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class)
public void testChangeMessageOfLastCommit(GitConnectionFactory connectionFactory) throws GitException, IOException {
//given
GitConnection connection = connectToGitRepositoryWithContent(connectionFactory, repository);
addFile(connection, "NewFile.txt", CONTENT);
connection.add(AddParams.create(ImmutableList.of("NewFile.txt")));
connection.commit(CommitParams.create("First commit"));
int beforeCommitsCount = connection.log(LogParams.create()).getCommits().size();
//when
CommitParams commitParams = CommitParams.create("Changed message").withAmend(true);
connection.commit(commitParams);
//then
int afterCommitsCount = connection.log(LogParams.create()).getCommits().size();
assertEquals(beforeCommitsCount, afterCommitsCount);
assertEquals(connection.log(LogParams.create()).getCommits().get(0).getMessage(), commitParams.getMessage());
}
Aggregations