Package com.github.jreddit.utils.restclient

Examples of com.github.jreddit.utils.restclient.Response


     */
    @Test
    public void testConnect() throws Exception {
     
      // Stub response
      Response loginResponse = new UtilResponse(null, userLoginResponse(COOKIE, MOD_HASH), 200);
        when(restClient.post("api_type=json&user=" + USERNAME + "&passwd=" + PASSWORD, String.format(ApiEndpointUtils.USER_LOGIN, USERNAME), null)).thenReturn(loginResponse);
       
        // Connect user
        subject.connect();
       
View Full Code Here


        when(user.getModhash()).thenReturn(MOD_HASH);
    }

    @Test
    public void getUnreadMessages() {
        Response response = new UtilResponse("", someUnreadDirectMessage(), 200);

        when(restClient.get(String.format(MESSAGE_GET, UNREAD.getValue()), COOKIE)).thenReturn(response);

        List<Message> allUnread = underTest.getMessages(user, ALL_MESSAGES, UNREAD);
        assertNotNull(allUnread);
View Full Code Here

        assertTrue(allUnread.size() == 2);
    }

    @Test
    public void getInboxMessages() {
        Response response = new UtilResponse("", allDirectMessage(), 200);

        when(restClient.get(String.format(MESSAGE_GET, SENT.getValue()), COOKIE)).thenReturn(response);

        List<Message> allUnread = underTest.getMessages(user, ALL_MESSAGES, SENT);
        assertNotNull(allUnread);
View Full Code Here

        assertTrue(allUnread.size() == 3);
    }

    @Test
    public void getSentMessages() {
        Response response = new UtilResponse("", someSentMessages(), 200);

        when(restClient.get(String.format(MESSAGE_GET, INBOX.getValue()), COOKIE)).thenReturn(response);

        List<Message> allUnread = underTest.getMessages(user, ALL_MESSAGES, INBOX);
        assertNotNull(allUnread);
View Full Code Here

        assertTrue(allUnread.size() == 2);
    }

    @Test
    public void successfullySendMessage() {
        Response response = new UtilResponse("", messageSendSuccessResponse(), 200);

        when(restClient.post("captcha=" + CAPTCHA_TEXT + "&iden=" + CAPTCHA_IDEN +
                        "&subject=" + TEST_SUBJECT + "&text=" + TEST_BODY + "&to=" + DESTINATION_USER +
                        "&uh=" + user.getModhash(),
                        ApiEndpointUtils.MESSAGE_COMPOSE, user.getCookie())
View Full Code Here

TOP

Related Classes of com.github.jreddit.utils.restclient.Response

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.