Examples of FakeRequest


Examples of com.jcabi.http.request.FakeRequest

    }

    @Override
    @NotNull(message = "entry request is never NULL")
    public Request entry() {
        return new FakeRequest()
            .withBody("{}")
            .withStatus(HttpURLConnection.HTTP_OK);
    }
View Full Code Here

Examples of com.jcabi.http.request.FakeRequest

     * @throws Exception If something goes wrong.
     */
    @Test
    public void listReleaseAssets() throws Exception {
        final ReleaseAssets assets = new RtReleaseAssets(
            new FakeRequest().withStatus(HttpURLConnection.HTTP_OK)
                .withBody("[{\"id\":1},{\"id\":2}]"), release()
        );
        MatcherAssert.assertThat(
            assets.iterate(),
            Matchers.<ReleaseAsset>iterableWithSize(2)
View Full Code Here

Examples of com.jcabi.http.request.FakeRequest

     */
    @Test
    public void uploadReleaseAsset() throws Exception {
        final String body = "{\"id\":1}";
        final ReleaseAssets assets = new RtReleaseAssets(
            new FakeRequest().withStatus(HttpURLConnection.HTTP_CREATED)
                .withBody(body),
            release()
        );
        MatcherAssert.assertThat(
            assets.upload(body.getBytes(), "text/plain", "hello.txt")
View Full Code Here

Examples of com.jcabi.http.request.FakeRequest

     * @throws Exception if something goes wrong.
     */
    @Test
    public void getReleaseAsset() throws Exception {
        final ReleaseAssets assets = new RtReleaseAssets(
            new FakeRequest().withStatus(HttpURLConnection.HTTP_OK)
                .withBody("{\"id\":3}"),
                release()
        );
        MatcherAssert.assertThat(
            assets.get(Tv.THREE).number(),
View Full Code Here

Examples of com.jcabi.http.request.FakeRequest

     */
    @Test
    public void getBlob() throws Exception {
        final String sha = "6dcb09b5b57875f334f61aebed695e2e4193db52";
        final Blobs blobs = new RtBlobs(
            new FakeRequest().withBody(
                Json.createObjectBuilder()
                    .add("sha", sha)
                    .build()
                    .toString()
            ),
View Full Code Here

Examples of com.jcabi.http.request.FakeRequest

        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),
            "gistName"
        );
        final RtGistComment comment = new RtGistComment(
            new ApacheRequest(container.home()), gist, identifier
        );
View Full Code Here

Examples of com.jcabi.http.request.FakeRequest

                    .add("name", name)
                    .add("color", "f29513")
            )
        ).build();
        final Issue issue = new RtIssue(
            new FakeRequest().withBody(json.toString()), this.repo(), 1
        );
        final IssueLabels labels = new Issue.Smart(issue).roLabels();
        this.thrown.expect(UnsupportedOperationException.class);
        labels.add(new ArrayList<String>(0));
        this.thrown.expect(UnsupportedOperationException.class);
View Full Code Here

Examples of com.jcabi.http.request.FakeRequest

     */
    @Test
    public void describeAsJson() throws Exception {
        final JsonReadable limit = new RtLimit(
            Mockito.mock(Github.class),
            new FakeRequest().withBody(this.body()),
            "core"
        );
        MatcherAssert.assertThat(
            limit.json().toString(),
            Matchers.equalTo(
View Full Code Here

Examples of com.jcabi.http.request.FakeRequest

     */
    @Test(expected = IllegalStateException.class)
    public void throwsWhenResourceIsAbsent() throws Exception {
        final JsonReadable limit = new RtLimit(
            Mockito.mock(Github.class),
            new FakeRequest().withBody(this.body()),
            "absent"
        );
        MatcherAssert.assertThat(
            limit.json().toString(),
            Matchers.equalTo("{}")
View Full Code Here

Examples of com.jcabi.http.request.FakeRequest

    @Test
    public void checksWhoAmI() throws Exception {
        final String login = "monalia";
        final RtUser user = new RtUser(
            Mockito.mock(Github.class),
            new FakeRequest().withBody(
                Json.createObjectBuilder()
                    .add("login", login)
                    .build().toString()
            )
        );
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.