Search in sources :

Example 11 with Contents

use of com.jcabi.github.Contents in project jcabi-github by jcabi.

the class MkContentTest method fetchesJsonRepresentation.

/**
 * MkContent should be able to fetch its JSON representation.
 *
 * @throws Exception if some problem inside
 */
@Test
public void fetchesJsonRepresentation() throws Exception {
    final Contents contents = new MkGithub().randomRepo().contents();
    final String path = "fake.txt";
    final Content content = contents.create(jsonContent(path, "for json", "json test"));
    MatcherAssert.assertThat(// @checkstyle MultipleStringLiterals (1 line)
    content.json().getString("name"), Matchers.is(path));
}
Also used : Contents(com.jcabi.github.Contents) Content(com.jcabi.github.Content) Test(org.junit.Test)

Example 12 with Contents

use of com.jcabi.github.Contents in project jcabi-github by jcabi.

the class MkContentTest method canGetOwnPath.

/**
 * MkContent should be able to fetch its own path.
 *
 * @throws Exception if some problem inside
 */
@Test
public void canGetOwnPath() throws Exception {
    final Contents contents = new MkGithub().randomRepo().contents();
    final String path = "dummy.txt";
    final Content content = contents.create(jsonContent(path, "for path", "path test"));
    MatcherAssert.assertThat(content.path(), Matchers.is(path));
}
Also used : Contents(com.jcabi.github.Contents) Content(com.jcabi.github.Content) Test(org.junit.Test)

Aggregations

Contents (com.jcabi.github.Contents)12 Test (org.junit.Test)11 JsonObject (javax.json.JsonObject)4 Content (com.jcabi.github.Content)3 Repo (com.jcabi.github.Repo)1 InputStream (java.io.InputStream)1