Clover Coverage Report - Pebble 2.5-SNAPSHOT
Coverage timestamp: Sat Jun 12 2010 09:39:29 EST
9   38   3   3
0   22   0,33   3
3     1  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  AddCategoryActionTest       Line # 13 9 0% 3 0 100% 1.0
 
  (4)
 
1    package net.sourceforge.pebble.web.action;
2   
3    import net.sourceforge.pebble.Constants;
4    import net.sourceforge.pebble.domain.Category;
5    import net.sourceforge.pebble.web.view.ForwardView;
6    import net.sourceforge.pebble.web.view.View;
7   
8    /**
9    * Tests for the AddCategoryAction class.
10    *
11    * @author Simon Brown
12    */
 
13    public class AddCategoryActionTest extends SecureActionTestCase {
14   
 
15  4 toggle protected void setUp() throws Exception {
16  4 action = new AddCategoryAction();
17   
18  4 super.setUp();
19    }
20   
 
21  2 toggle public void testProcess() throws Exception {
22  2 View view = action.process(request, response);
23   
24  2 assertEquals(new Category(), action.getModel().get(Constants.CATEGORY_KEY));
25  2 assertTrue(view instanceof ForwardView);
26  2 assertEquals("/viewCategories.secureaction", ((ForwardView)view).getUri());
27    }
28   
29    /**
30    * Test that only blog contributors have access to add a blog entry.
31    */
 
32  2 toggle public void testOnlyBlogContributorsHaveAccess() {
33  2 String roles[] = action.getRoles(request);
34  2 assertEquals(1, roles.length);
35  2 assertEquals(Constants.BLOG_CONTRIBUTOR_ROLE, roles[0]);
36    }
37   
38    }