Clover Coverage Report - Pebble 2.5-SNAPSHOT
Coverage timestamp: Sat Jun 12 2010 09:39:29 EST
../../../../../img/srcFileCovDistChart0.png 48% of files have more coverage
6   86   6   1
0   29   1   6
6     1  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  MockStaticPageDAO       Line # 18 6 0% 6 12 0% 0.0
 
No Tests
 
1    package net.sourceforge.pebble.dao.mock;
2   
3    import net.sourceforge.pebble.dao.PersistenceException;
4    import net.sourceforge.pebble.dao.StaticPageDAO;
5    import net.sourceforge.pebble.domain.Blog;
6    import net.sourceforge.pebble.domain.StaticPage;
7   
8    import java.util.Collection;
9    import java.util.HashMap;
10    import java.util.Map;
11   
12    /**
13    * This is a mock implementation of StaticPageDAO that is used when performing
14    * unit tests.
15    *
16    * @author Simon Brown
17    */
 
18    public class MockStaticPageDAO implements StaticPageDAO {
19   
20    private Map<String,StaticPage> pages = new HashMap<String,StaticPage>();
21   
22    /**
23    * Loads the static pages for a given blog.
24    *
25    * @param blog the owning Blog instance
26    * @return a Collection of StaticPage instances
27    * @throws PersistenceException if static pages cannot be loaded
28    */
 
29  0 toggle public Collection<StaticPage> loadStaticPages(Blog blog) throws PersistenceException {
30  0 return pages.values();
31    }
32   
33    /**
34    * Loads a specific static page.
35    *
36    * @param blog the owning Blog
37    * @param pageId the page ID
38    * @return a StaticPage instance
39    * @throws PersistenceException if the static page cannot be loaded
40    */
 
41  0 toggle public StaticPage loadStaticPage(Blog blog, String pageId) throws PersistenceException {
42  0 return pages.get(pageId);
43    }
44   
45    /**
46    * Stores the specified static page.
47    *
48    * @param staticPage the static page to store
49    * @throws net.sourceforge.pebble.dao.PersistenceException
50    * if something goes wrong storing the static page
51    */
 
52  0 toggle public void storeStaticPage(StaticPage staticPage) throws PersistenceException {
53  0 pages.put(staticPage.getId(), staticPage);
54    }
55   
56    /**
57    * Removes the specified static page.
58    *
59    * @param staticPage the static page to remove
60    * @throws net.sourceforge.pebble.dao.PersistenceException
61    * if something goes wrong removing the page
62    */
 
63  0 toggle public void removeStaticPage(StaticPage staticPage) throws PersistenceException {
64  0 pages.remove(staticPage.getId());
65    }
66   
67    /**
68    * Locks the specified static page.
69    *
70    * @param staticPage the static page to lock
71    * @return true if the page could be locked, false otherwise
72    */
 
73  0 toggle public boolean lock(StaticPage staticPage) {
74  0 return true;
75    }
76   
77    /**
78    * Unlocks the specified static page.
79    *
80    * @param staticPage the static page to unlock
81    * @return true if the page could be unlocked, false otherwise
82    */
 
83  0 toggle public boolean unlock(StaticPage staticPage) {
84  0 return true;
85    }
86    }