Package com.github.jreddit.entity

Examples of com.github.jreddit.entity.UserInfo


    @Test
    public void getUserInformationSuccessfully() {
        response = new UtilResponse(null, createUserInfo(USERNAME), 200);
        when(restClient.get(ApiEndpointUtils.USER_INFO, COOKIE)).thenReturn(response);

        UserInfo info = subject.getUserInformation();
        assertNotNull(info);
    }
View Full Code Here


    @Test
    public void getAboutUserSuccessfully() {
        response = new UtilResponse(null, createUserAbout(USERNAME), 200);
        when(restClient.get(String.format(ApiEndpointUtils.USER_ABOUT, USERNAME), null)).thenReturn(response);

        UserInfo userInfo = subject.about(USERNAME);
        assertNotNull(userInfo);
        assertEquals(userInfo.getName(), USERNAME);
    }
View Full Code Here

    @Test
    public void getAboutUserForUnknownUser() {
        response = new UtilResponse(null, new JSONObject(singletonMap("error", 404)), 404);
        when(restClient.get(String.format(ApiEndpointUtils.USER_ABOUT, UNKNOWN_USERNAME), null)).thenReturn(response);

        UserInfo userInfo = subject.about(UNKNOWN_USERNAME);
        assertNull(userInfo);
    }
View Full Code Here

        }

        JSONObject jsonObject = (JSONObject) restClient.get(ApiEndpointUtils.USER_INFO, user.getCookie()).getResponseObject();
        JSONObject info = (JSONObject) jsonObject.get("data");

        return new UserInfo(info);
    }
View Full Code Here

        // Send GET request to get the account overview
        JSONObject object = (JSONObject) restClient.get(String.format(ApiEndpointUtils.USER_ABOUT, username), null).getResponseObject();
        JSONObject data = (JSONObject) object.get("data");

        // Init account info wrapper
        return data != null ? new UserInfo(data) : null;
    }
View Full Code Here

TOP

Related Classes of com.github.jreddit.entity.UserInfo

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.