Code example for AbstractTransactionalTestNGSpringContextTests

Methods: assertEquals

0
        List<Branch> createdBranches = new ArrayList<>(branchesOfSecondSection); 
        createdBranches.addAll(branchesOfFirstSection); 
 
        List<Branch> selectedBranches = dao.getAllBranches(); 
 
        assertEquals(createdBranches, selectedBranches);//checking the order 
    } 
 
    @Test 
    public void testGetCountPostsInBranch() { 
        //topic with one post 
        Topic topic = PersistedObjectsFactory.getDefaultTopic(); 
        Branch branch = topic.getBranch(); 
        //add two posts 
        topic.addPost(new Post(topic.getTopicStarter(), "Second post")); 
        topic.addPost(new Post(topic.getTopicStarter(), "Third post")); 
        // 
        session.save(branch); 
        int expectedCount = topic.getPosts().size();