1   /*
2    * Created on Jun 25, 2004
3    *
4    */
5   package com.sun.syndication.unittest;
6   
7   import java.util.List;
8   
9   import com.sun.syndication.feed.module.DCModuleI;
10  import com.sun.syndication.feed.module.DCSubjectI;
11  
12  /***
13   * @author pat
14   *
15   */
16  
17  public abstract class SyndFeedRSS10_DC_Sy_CommonTest extends SyndFeedTest {
18      private String _elementPrefix;
19  
20      protected SyndFeedRSS10_DC_Sy_CommonTest(String elementPrefix) {
21          super("rss_1.0", "rss_1.0_DC_Sy.xml");
22          _elementPrefix = elementPrefix;
23      }
24  
25      protected String getPrefix() {
26          return super.getPrefix()+"."+_elementPrefix;
27      }
28      
29      protected abstract DCModuleI getDCModule() throws Exception;
30  
31      public void testFeedDCPresent() throws Exception {
32          assertNotNull(getDCModule());
33      }
34  
35      public void testFeedDCUri()  throws Exception {
36          assertEquals("http://purl.org/dc/elements/1.1/", getDCModule().getUri());
37      }
38  
39      public void testFeedDCTitle() throws Exception {
40          assertEqualsStr("dc:title", getDCModule().getTitle());
41      }
42  
43      public void testFeedDCCreator()  throws Exception {
44          assertEqualsStr("dc:creator", getDCModule().getCreator());
45      }
46  
47      public void testFeedDCSubject() throws Exception {
48          List subjects = getDCModule().getSubjects();
49          assertEquals(2, subjects.size());
50          DCSubjectI subject = null;
51          for (int i=0; i<subjects.size();i++) {
52              subject = (DCSubjectI)subjects.get(i);
53              assertEqualsStr("dc:subject[" + i +"]", subject.getValue());
54              assertEqualsStr("dc:subject[" + i +"].taxo:topic^resource", subject.getTaxonomyUri());
55          }
56      }
57  
58  }