Examples of UtilResponse


Examples of com.github.jreddit.testsupport.UtilResponse

    public void setup() {
        user = mock(User.class);
        when(user.getCookie()).thenReturn(COOKIE);
        restClient = mock(RestClient.class);
        subject = new Comments(restClient);
        normalFlatResponse = new UtilResponse(null, commentFlatListings(), 200);
        normalLayeredResponse = new UtilResponse(null, commentLayeredListings(), 200);
    }
View Full Code Here

Examples of com.github.jreddit.testsupport.UtilResponse

    public void setup() {
      user = mock(User.class);
        when(user.getCookie()).thenReturn(COOKIE);
        restClient = mock(RestClient.class);
        subject = new Subreddits(restClient, user);
        normalResponse = new UtilResponse(null, subredditListings(), 200);
    }
View Full Code Here

Examples of com.github.jreddit.testsupport.UtilResponse

    public void setUp() {
        user = mock(User.class);
        when(user.getCookie()).thenReturn(COOKIE);
        restClient = mock(RestClient.class);
        subject = new Submissions(restClient, user);
        normalResponse = new UtilResponse(null, submissionListings(), 200);
    }
View Full Code Here

Examples of com.github.jreddit.testsupport.UtilResponse

    @Test
    public void testParseRedditError() {
     
      // Stub REST client methods
      String url = "/r/fake";
        when(restClient.get(url, COOKIE)).thenReturn(new UtilResponse(null, createRedditError(403), 200));
        when(user.getCookie()).thenReturn(COOKIE);

        // Retrieve the submissions
        exception.expect(RedditError.class);
        subject.parse(url);
View Full Code Here

Examples of com.github.jreddit.testsupport.UtilResponse

        underTest.newCaptcha(user);
    }

    @Test
    public void needsCaptchaReturnsTrue() {
        response = new UtilResponse("true", true, 200);

        when(user.getCookie()).thenReturn("cookie");
        when(restClient.get(ApiEndpointUtils.CAPTCHA_NEEDS, "cookie")).thenReturn(response);

        assertTrue(underTest.needsCaptcha(user));
View Full Code Here

Examples of com.github.jreddit.testsupport.UtilResponse

        assertTrue(underTest.needsCaptcha(user));
    }

    @Test
    public void needsCaptchaReturnsFalse() {
        response = new UtilResponse("false", false, 200);

        when(user.getCookie()).thenReturn("cookie");
        when(restClient.get(ApiEndpointUtils.CAPTCHA_NEEDS, "cookie")).thenReturn(response);

        assertFalse(underTest.needsCaptcha(user));
View Full Code Here

Examples of com.github.jreddit.testsupport.UtilResponse

        assertFalse(underTest.needsCaptcha(user));
    }

    @Test
    public void needsCaptchaReceivesFalseAndReturnsFalse() {
        response = new UtilResponse("false", false, 200);

        when(user.getCookie()).thenReturn("cookie");
        when(restClient.get(ApiEndpointUtils.CAPTCHA_NEEDS, "cookie")).thenReturn(response);

        assertFalse(underTest.needsCaptcha(user));
View Full Code Here

Examples of com.github.jreddit.testsupport.UtilResponse

        assertFalse(underTest.needsCaptcha(user));
    }
   
    @Test
    public void needsCaptchaReceivesTrueAndReturnsTrue() {
        response = new UtilResponse("true", true, 200);

        when(user.getCookie()).thenReturn("cookie");
        when(restClient.get(ApiEndpointUtils.CAPTCHA_NEEDS, "cookie")).thenReturn(response);

        assertTrue(underTest.needsCaptcha(user));
View Full Code Here

Examples of com.github.jreddit.testsupport.UtilResponse

        assertTrue(underTest.needsCaptcha(user));
    }

    private Response generateBadlyFormedJson() throws ParseException {
        return new UtilResponse("", fooJsonObject(), 200);
    }
View Full Code Here

Examples of com.github.jreddit.testsupport.UtilResponse

        return jsonObject;
    }

    private Response generateNewCaptchaResponseWithIdent(String ident) throws ParseException {
        JSONObject responseObject = newCaptchaJsonResponseWith(ident);
        return new UtilResponse("", responseObject, 200);
    }
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.