Examples of MkGrizzlyContainer


Examples of com.jcabi.http.mock.MkGrizzlyContainer

     */
    @Test
    public void createIssue() throws Exception {
        final String title = "Found a bug";
        final String body = issue(title).toString();
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_CREATED, body)
        ).next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, body)).start();
        final RtIssues issues = new RtIssues(
            new JdkRequest(container.home()),
            repo()
View Full Code Here

Examples of com.jcabi.http.mock.MkGrizzlyContainer

     * @throws Exception if some problem inside
     */
    @Test
    public void getSingleIssue() throws Exception {
        final String title = "Unit test";
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                issue(title).toString()
            )
        ).start();
View Full Code Here

Examples of com.jcabi.http.mock.MkGrizzlyContainer

     * RtIssues can iterate issues.
     * @throws Exception if there is any error
     */
    @Test
    public void iterateIssues() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                Json.createArrayBuilder()
                    .add(issue("new issue"))
                    .add(issue("code issue"))
View Full Code Here

Examples of com.jcabi.http.mock.MkGrizzlyContainer

     * @throws Exception if there is a problem.
     * @checkstyle MultipleStringLiteralsCheck (20 lines)
     */
    @Test
    public void readsFileWithContents() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                "{\"files\":{\"hello\":{\"raw_url\":\"world\"}}}"
            )
        ).next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "success!"))
View Full Code Here

Examples of com.jcabi.http.mock.MkGrizzlyContainer

     * RtGist should be able to do writes.
     * @throws Exception if there is a problem.
     */
    @Test
    public void writesFileContents() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "testFileWrite")
        ).start();
        final RtGist gist = new RtGist(
            new MkGithub(),
            new ApacheRequest(container.home()),
View Full Code Here

Examples of com.jcabi.http.mock.MkGrizzlyContainer

     * @throws IOException If there is a problem.
     */
    @Test
    public void fork() throws IOException {
        final String fileContent = "success";
        final MkContainer container = new MkGrizzlyContainer();
        container.next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                "{\"files\":{\"hello\":{\"raw_url\":\"world\"}}}"
            )
        );
        container.next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, fileContent)
        );
        container.next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_CREATED,
                "{\"id\": \"forked\"}"
            )
        );
        container.next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                "{\"files\":{\"hello\":{\"raw_url\":\"world\"}}}"
            )
        );
        container.next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, fileContent)
        );
        container.start();
        final Gist gist = new RtGist(
            new MkGithub(),
            new ApacheRequest(container.home()),
            "test"
        );
        final String content = gist.read("hello");
        final Gist forkedGist = gist.fork();
        try {
            MatcherAssert.assertThat(
                forkedGist.read("hello"),
                Matchers.equalTo(content)
            );
        } finally {
            container.stop();
        }
    }
View Full Code Here

Examples of com.jcabi.http.mock.MkGrizzlyContainer

     *
     * @throws Exception if something goes wrong.
     */
    @Test
    public void canIterateFiles() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                "{\"files\":{\"something\":{\"filename\":\"not null\"}}}"
            )
        ).start();
View Full Code Here

Examples of com.jcabi.http.mock.MkGrizzlyContainer

     *
     * @throws Exception If something goes wrong.
     */
    @Test
    public void canRepresentAsString() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().start();
        final RtGist gist = new RtGist(
            new MkGithub(),
            new ApacheRequest(container.home()),
            "testToString"
        );
View Full Code Here

Examples of com.jcabi.http.mock.MkGrizzlyContainer

     * RtGist can unstar a starred Gist.
     * @throws Exception If something goes wrong.
     */
    @Test
    public void canUnstarAGist() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_NO_CONTENT, "")
        ).start();
        final RtGist gist = new RtGist(
            new MkGithub(),
            new ApacheRequest(container.home()),
View Full Code Here

Examples of com.jcabi.http.mock.MkGrizzlyContainer

     *
     * @throws Exception if there is any problem
     */
    @Test
    public void executePatchRequest() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "{\"msg\":\"hi\"}")
        ).start();
        try {
            final RtGist gist = new RtGist(
                new MkGithub(),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.