* @throws Exception Exception if some problem inside
*/
@Test
public void updatesFileCreateCommit() throws Exception {
final MkStorage storage = new MkStorage.InFile();
final Contents contents = MkContentsTest.repo(storage).contents();
final String path = "file.txt";
final JsonObject json = MkContentsTest
.content(path, "theCreateMessage", "newContent")
.add("committer", MkContentsTest.committer())
.build();
contents.create(json);
final String xpath = "/github/repos/repo/commits/commit";
MatcherAssert.assertThat(
storage.xml().nodes(xpath),
Matchers.<XML>iterableWithSize(1)
);
final JsonObject update = MkContentsTest
.content(path, "theMessage", "blah")
.build();
MatcherAssert.assertThat(
new RepoCommit.Smart(contents.update(path, update)).sha(),
Matchers.not(Matchers.isEmptyOrNullString())
);
MatcherAssert.assertThat(
new Content.Smart(contents.get(path, "master")).path(),
Matchers.is(path)
);
MatcherAssert.assertThat(
storage.xml().nodes(xpath),
Matchers.<XML>iterableWithSize(2)