Clover Coverage Report - Pebble 2.5-SNAPSHOT
Coverage timestamp: Sat Jun 12 2010 09:39:29 EST
../../../../../img/srcFileCovDistChart6.png 36% of files have more coverage
7   68   4   1,75
0   25   0,57   4
4     1  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  MockBlogEntryDAO       Line # 16 7 0% 4 5 54,5% 0.54545456
 
  (198)
 
1    package net.sourceforge.pebble.dao.mock;
2   
3    import net.sourceforge.pebble.dao.BlogEntryDAO;
4    import net.sourceforge.pebble.dao.PersistenceException;
5    import net.sourceforge.pebble.domain.Blog;
6    import net.sourceforge.pebble.domain.BlogEntry;
7   
8    import java.util.*;
9   
10    /**
11    * This is a mock implementation of BlogEntryDAO that is used when performing
12    * unit tests.
13    *
14    * @author Simon brown
15    */
 
16    public class MockBlogEntryDAO implements BlogEntryDAO {
17   
18    private Map blogEntries = new HashMap();
19   
20    /**
21    * Loads a specific blog entry.
22    *
23    * @param blogEntryId the blog entry ID
24    * @return a BlogEntry instance
25    * @throws net.sourceforge.pebble.dao.PersistenceException
26    * if the specified blog entry cannot be loaded
27    */
 
28  552 toggle public BlogEntry loadBlogEntry(Blog blog, String blogEntryId) throws PersistenceException {
29  552 return (BlogEntry)blogEntries.get(blogEntryId);
30    }
31   
32    /**
33    * Loads all blog entries.
34    *
35    * @param blog the Blog to load all entries for
36    * @return a List of BlogEntry objects
37    * @throws net.sourceforge.pebble.dao.PersistenceException
38    * if the blog entries cannot be loaded
39    */
 
40  0 toggle public Collection<BlogEntry> loadBlogEntries(Blog blog) throws PersistenceException {
41  0 List<BlogEntry> list = new ArrayList<BlogEntry>();
42  0 for (Object o : blogEntries.values()) {
43  0 list.add((BlogEntry)o);
44    }
45  0 return list;
46    }
47   
48    /**
49    * Stores the specified blog entry.
50    *
51    * @param blogEntry the blog entry to store
52    * @throws PersistenceException if something goes wrong storing the entry
53    */
 
54  644 toggle public void storeBlogEntry(BlogEntry blogEntry) throws PersistenceException {
55  644 blogEntries.put(blogEntry.getId(), blogEntry);
56    }
57   
58    /**
59    * Removes the specified blog entry.
60    *
61    * @param blogEntry the blog entry to remove
62    * @throws PersistenceException if something goes wrong removing the entry
63    */
 
64  18 toggle public void removeBlogEntry(BlogEntry blogEntry) throws PersistenceException {
65  18 blogEntries.remove(blogEntry.getId());
66    }
67   
68    }