Package com.jcabi.http.mock

Examples of com.jcabi.http.mock.MkGrizzlyContainer


     *
     * @throws Exception if there is any problem
     */
    @Test
    public void sendHttpRequestAndWriteResponseAsJson() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "{\"msg\": \"hi\"}")
        ).start();
        final RtLabel label = new RtLabel(
            new ApacheRequest(container.home()),
            RtLabelTest.repo(),
View Full Code Here


     *
     * @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();
        final RtLabel label = new RtLabel(
            new ApacheRequest(container.home()),
            RtLabelTest.repo(),
View Full Code Here

     */
    @Test
    public void canCreateBlob() throws Exception {
        final String content = "Content of the blob";
        final String body = blob().toString();
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_CREATED, body)
        ).next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, body)).start();
        final RtBlobs blobs = new RtBlobs(
            new ApacheRequest(container.home()),
            repo()
View Full Code Here

                .add(bodyString, body)
                .add(idString, identifier)
                .build().toString()
        );
        final MkContainer container =
            new MkGrizzlyContainer().next(first).next(second).next(third)
                .start();
        final MkContainer gistContainer = new MkGrizzlyContainer().start();
        final RtGist gist =
            new RtGist(
                new MkGithub(),
                new ApacheRequest(gistContainer.home()), "someName"
            );
View Full Code Here

     * @throws IOException if has some problems with json parsing.
     */
    @Test
    public final void removeGistComment() throws IOException {
        final int identifier = 1;
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_NO_CONTENT, "")
        ).start();
        final RtGist gist = new RtGist(
            new MkGithub(),
            new FakeRequest().withStatus(HttpURLConnection.HTTP_NO_CONTENT),
View Full Code Here

     *
     * @throws Exception if a problem occurs.
     */
    @Test
    public void retrievesKeys() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                Json.createArrayBuilder()
                    .add(key(1))
                    .add(key(2))
View Full Code Here

     *
     * @throws Exception if a problem occurs.
     */
    @Test
    public void canFetchSingleKey() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                ""
            )
        ).start();
View Full Code Here

     *
     * @throws Exception if a problem occurs.
     */
    @Test
    public void canRemoveKey() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_NO_CONTENT,
                ""
            )
        ).start();
View Full Code Here

     * RtPublicKeys can create a key.
     * @throws IOException If some problem inside.
     */
    @Test
    public void canCreatePublicKey() throws IOException {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_CREATED, key(1).toString()
            )
        ).start();
        try {
View Full Code Here

     *
     * @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,
                "{\"login\":\"octocate\"}"
            )
        ).start();
View Full Code Here

TOP

Related Classes of com.jcabi.http.mock.MkGrizzlyContainer

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.