Clover Coverage Report - Pebble 2.5-SNAPSHOT
Coverage timestamp: Sat Jun 12 2010 09:39:29 EST
16   53   3   5,33
0   33   0,19   3
3     1  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  FileStaticPageDAOTest       Line # 16 16 0% 3 0 100% 1.0
 
  (2)
 
1    package net.sourceforge.pebble.dao.file;
2   
3    import net.sourceforge.pebble.dao.StaticPageDAO;
4    import net.sourceforge.pebble.domain.SingleBlogTestCase;
5    import net.sourceforge.pebble.domain.StaticPage;
6    import net.sourceforge.pebble.util.FileUtils;
7   
8    import java.io.File;
9    import java.util.Locale;
10   
11    /**
12    * Tests for the FileStaticPageDAO class.
13    *
14    * @author Simon Brown
15    */
 
16    public class FileStaticPageDAOTest extends SingleBlogTestCase {
17   
18    private StaticPageDAO dao= new FileStaticPageDAO();
19    private Locale defaultLocale;
20   
 
21  2 toggle protected void setUp() throws Exception {
22  2 super.setUp();
23   
24  2 defaultLocale = Locale.getDefault();
25  2 Locale.setDefault(Locale.ENGLISH);
26    }
27   
28   
 
29  2 toggle public void tearDown() throws Exception {
30  2 super.tearDown();
31   
32  2 Locale.setDefault(defaultLocale);
33    }
34   
 
35  2 toggle public void testLoadStaticPageFomFile() throws Exception {
36   
37  2 File source = new File(TEST_RESOURCE_LOCATION, "1152083300843.xml");
38  2 File destination = new File(blog.getRoot(), "pages/1152083300843");
39  2 destination.mkdirs();
40  2 FileUtils.copyFile(source, new File(destination, "1152083300843.xml"));
41   
42  2 StaticPage page = dao.loadStaticPage(blog, "1152083300843");
43   
44    // test that the static page properties were loaded okay
45  2 assertEquals("Static page title", page.getTitle());
46  2 assertEquals("Static page subtitle", page.getSubtitle());
47  2 assertEquals("<p>Static page body.</p>", page.getBody());
48  2 assertEquals("some tags", page.getTags());
49  2 assertEquals(1152083300843L, page.getDate().getTime());
50  2 assertEquals("http://pebble.sourceforge.net", page.getOriginalPermalink());
51    }
52   
53    }