Package org.jtalks.jcommune.model.dto

Examples of org.jtalks.jcommune.model.dto.PageRequest


    }

    @Test
    public void testGetUnansweredTopicsForAnonymousUsers() {
        createAndSaveTopicsWithUnansweredTopics();
        PageRequest pageRequest = new PageRequest("1", 2);

        Page<Topic> result = dao.getUnansweredTopics(pageRequest, new AnonymousUser());
        assertEquals(result.getContent().size(), 2);
        assertEquals(result.getTotalElements(), 2);
    }
View Full Code Here


    }

    @Test
    public void testGetUnansweredTopicsWithPaging() {
        JCUser user = createAndSaveTopicsWithUnansweredTopics();
        PageRequest pageRequest = new PageRequest("2", 1);
        Page<Topic> result = dao.getUnansweredTopics(pageRequest, user);
        assertEquals(result.getContent().size(), 1);
        assertEquals(result.getTotalElements(), 2);
    }
View Full Code Here

    }

    @Test
    public void testGetUnansweredTopicsWithPagingPageTooLow() {
        JCUser user = createAndSaveTopicsWithUnansweredTopics();
        PageRequest pageRequest = new PageRequest("0", 1);
        Page<Topic> result = dao.getUnansweredTopics(pageRequest, user);
        assertEquals(result.getContent().size(), 1);
        assertEquals(result.getTotalElements(), 2);
        assertEquals(result.getNumber(), 1);
    }
View Full Code Here

    }

    @Test
    public void testGetUnansweredTopicsWithPagingPageTooBig() {
        JCUser user = createAndSaveTopicsWithUnansweredTopics();
        PageRequest pageRequest = new PageRequest("1000", 1);
        Page<Topic> result = dao.getUnansweredTopics(pageRequest, user);
        assertEquals(result.getContent().size(), 1);
        assertEquals(result.getTotalElements(), 2);
        assertEquals(result.getNumber(), 2);
    }
View Full Code Here

    @Test
    public void testGetTopicsWithEnabledPaging() {
        int totalSize = 50;
        int pageCount = 2;
        int pageSize = totalSize / pageCount;
        PageRequest pageRequest = new PageRequest("1", pageSize);
        List<Topic> topicList = PersistedObjectsFactory.createAndSaveTopicList(totalSize);
        Branch branch = topicList.get(0).getBranch();

        Page<Topic> topicsPage = dao.getTopics(branch, pageRequest);
View Full Code Here

    @Test
    public void testGetTopicsWithEnabledPagingPageTooLow() {
        int totalSize = 50;
        int pageCount = 2;
        int pageSize = totalSize / pageCount;
        PageRequest pageRequest = new PageRequest("0", pageSize);
        List<Topic> topicList = PersistedObjectsFactory.createAndSaveTopicList(totalSize);
        Branch branch = topicList.get(0).getBranch();

        Page<Topic> topicsPage = dao.getTopics(branch, pageRequest);
View Full Code Here

    @Test
    public void testGetTopicsWithEnabledPagingTooBigg() {
        int totalSize = 50;
        int pageCount = 2;
        int pageSize = totalSize / pageCount;
        PageRequest pageRequest = new PageRequest("1000",
                pageSize);
        List<Topic> topicList = PersistedObjectsFactory.createAndSaveTopicList(totalSize);
        Branch branch = topicList.get(0).getBranch();

        Page<Topic> topicsPage = dao.getTopics(branch, pageRequest);
View Full Code Here

    public void testPostOfUser() {
        int totalSize = 50;
        int pageCount = 2;
        int pageSize = totalSize / pageCount;

        PageRequest pageRequest = new PageRequest("1", pageSize);
        List<Post> posts = PersistedObjectsFactory.createAndSavePostList(totalSize);
        JCUser author = posts.get(0).getUserCreated();
        List<Long> allowedBranchesIds = new ArrayList<>();
        allowedBranchesIds.add(posts.get(0).getTopic().getBranch().getId());
View Full Code Here

    public void testPostOfUserWithForbiddenBranchesIds() {
        int totalSize = 50;
        int pageCount = 2;
        int pageSize = totalSize / pageCount;

        PageRequest pageRequest = new PageRequest("1", pageSize);
        List<Post> posts = PersistedObjectsFactory.createAndSavePostList(totalSize);
        JCUser author = posts.get(0).getUserCreated();
        List<Long> allowedBranchesIds = new ArrayList<>();
        allowedBranchesIds.add(-1L);
View Full Code Here

    public void testReturnedUserPostListIsSortedInDescOrderByDate() {
        int totalSize = 50;
        int pageCount = 2;
        int pageSize = totalSize / pageCount;

        PageRequest pageRequest = new PageRequest("1", pageSize);
        List<Post> posts = PersistedObjectsFactory.createAndSavePostList(totalSize);
        JCUser author = posts.get(0).getUserCreated();
        List<Long> allowedBranchesIds = new ArrayList<>();
        allowedBranchesIds.add(posts.get(0).getTopic().getBranch().getId());
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.model.dto.PageRequest

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.