Package com.jcabi.github

Examples of com.jcabi.github.Gist$Smart


     * MkGists can work with gists.
     * @throws Exception If some problem inside
     */
    @Test
    public void worksWithMockedGists() throws Exception {
        final Gist gist = new MkGithub().gists().create(
            Collections.singletonMap("test-file-name.txt", "none"), false
        );
        final String file = "t.txt";
        gist.write(file, "hello, everybody!");
        MatcherAssert.assertThat(
            gist.read(file),
            Matchers.startsWith("hello, ")
        );
    }
View Full Code Here


     * @throws Exception - if anything goes wrong.
     */
    @Test
    public void removesGistByIdentifier() throws Exception {
        final Gists gists = new MkGithub().gists();
        final Gist gist = gists.create(
            Collections.singletonMap("fileName.txt", "content"), false
        );
        MatcherAssert.assertThat(
            gists.iterate(),
            Matchers.hasItem(gist)
        );
        gists.remove(gist.identifier());
        MatcherAssert.assertThat(
            gists.iterate(),
            Matchers.not(Matchers.hasItem(gist))
        );
    }
View Full Code Here

     * @throws Exception If some problem inside
     */
    @Test
    public void worksWithSeveralGists() throws Exception {
        final Gists gists = new MkGithub().gists();
        final Gist gist = gists.create(
            Collections.singletonMap("test-file-name.txt", "none"), false
        );
        final Gist othergist = gists.create(
            Collections.singletonMap("test-file-name2.txt", ""), false
        );
        final String file = "t.txt";
        gist.write(file, "hello, everybody!");
        othergist.write(file, "bye, everybody!");
        MatcherAssert.assertThat(
            gist.read(file),
            Matchers.startsWith("hello, ")
        );
        MatcherAssert.assertThat(
            othergist.read(file),
            Matchers.startsWith("bye, ")
        );
    }
View Full Code Here

     * Test starring and star-checking of a gist.
     * @throws Exception If some problem inside
     */
    @Test
    public void testStar() throws Exception {
        final Gist gist = new MkGithub().gists().create(
            Collections.singletonMap("file-name.txt", ""), false
        );
        MatcherAssert.assertThat(
            gist.starred(),
            Matchers.equalTo(false)
        );
        gist.star();
        MatcherAssert.assertThat(
            gist.starred(),
            Matchers.equalTo(true)
        );
    }
View Full Code Here

     * Test unstarring and star-checking of a gist.
     * @throws Exception If some problem inside
     */
    @Test
    public void testUnstar() throws Exception {
        final Gist gist = new MkGithub().gists().create(
            Collections.singletonMap("file-name.txt", ""), false
        );
        MatcherAssert.assertThat(
            gist.starred(),
            Matchers.equalTo(false)
        );
        gist.star();
        MatcherAssert.assertThat(
            gist.starred(),
            Matchers.equalTo(true)
        );
        gist.unstar();
        MatcherAssert.assertThat(
            gist.starred(),
            Matchers.equalTo(false)
        );
    }
View Full Code Here

     * @throws IOException If some problem inside
     */
    @Test
    public void createGistWithEmptyFile() throws IOException {
        final String filename = "file.txt";
        final Gist gist = new MkGithub().gists().create(
            Collections.singletonMap(filename, ""), false
        );
        MatcherAssert.assertThat(
            gist.read(filename),
            Matchers.isEmptyString()
        );
    }
View Full Code Here

     */
    @Test
    public void readEmptyGistFile() throws IOException {
        // @checkstyle MultipleStringLiterals (1 lines)
        final String filename = "file.txt";
        final Gist gist = new MkGithub().gists().create(
            Collections.singletonMap(filename, ""), false
        );
        MatcherAssert.assertThat(
            gist.read(filename),
            Matchers.isEmptyString()
        );
    }
View Full Code Here

     * @throws IOException If some problem inside
     */
    @Test
    public void fork() throws IOException {
        final String filename = "file.txt";
        final Gist gist = new MkGithub().gists().create(
            Collections.singletonMap(filename, ""), false
        );
        gist.write(filename, "Hello, github!");
        final Gist forkedGist = gist.fork();
        MatcherAssert.assertThat(
            forkedGist.read(filename),
            Matchers.equalTo(gist.read(filename))
        );
    }
View Full Code Here

TOP

Related Classes of com.jcabi.github.Gist$Smart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.