Code example for AbstractTransactionalTestNGSpringContextTests

Methods: assertEquals

0
            DateTime creationDatePrevious = postList.get(i - 1).getCreationDate(); 
            DateTime creationDate = postList.get(i).getCreationDate(); 
            assertTrue(creationDatePrevious.compareTo(creationDate) >= 0); 
        } 
 
        assertEquals(postsPage.getContent().size(), pageSize, "Incorrect count of posts in one page."); 
        assertEquals(postsPage.getTotalElements(), totalSize, "Incorrect total count."); 
        assertEquals(postsPage.getTotalPages(), pageCount, "Incorrect count of pages."); 
        assertEquals(postsPage.getNumber(), 1, "Incorrect page number"); 
    } 
 
    @Test 
    public void testPostOfUserWithEnabledPagingPageTooBig() { 
        int totalSize = 50; 
        int pageCount = 2; 
        int pageSize = totalSize / pageCount; 
 
        PageRequest pageRequest = new PageRequest( 
                PAGE_NUMBER_TOO_BIG, pageSize); 
        List<Post> posts = PersistedObjectsFactory.createAndSavePostList(totalSize);