1   /*
2    * Created on Jun 24, 2004
3    *
4    */
5   package com.sun.syndication.unittest;
6   
7   import com.sun.syndication.feed.synd.SyndEntry;
8   import com.sun.syndication.feed.synd.SyndContent;
9   import com.sun.syndication.io.impl.DateParser;
10  
11  import java.util.List;
12  import java.util.Date;
13  
14  /***
15   * @author pat
16   * @author Dave Johnson (modified for Atom 1.0)
17   *
18   */
19  public class TestSyndFeedAtom10 extends SyndFeedTest {
20  
21  	public TestSyndFeedAtom10() {
22  		super("atom_1.0");
23  	}
24  
25      protected TestSyndFeedAtom10(String type) {
26          super(type);
27      }
28  
29      protected TestSyndFeedAtom10(String feedType,String feedFileName) {
30          super(feedType,feedFileName);
31      }
32  
33      public void testTitle() throws Exception {
34          assertProperty(getCachedSyndFeed().getTitle(),"feed.title");
35      }
36  
37      public void testLink() throws Exception {
38          assertEquals( getCachedSyndFeed().getLink(),"http://example.com/blog/atom_1.0.xml");
39      }
40  
41      public void getAuthor() throws Exception {
42          assertProperty(getCachedSyndFeed().getAuthor(),"feed.author.name");
43      }
44  
45      public void testCopyright() throws Exception {
46          assertProperty(getCachedSyndFeed().getCopyright(),"feed.copyright");
47      }
48  
49      public void testPublishedDate() throws Exception {
50          Date d = DateParser.parseW3CDateTime("2000-01-01T00:00:00Z");
51          assertEquals(getCachedSyndFeed().getPublishedDate(),d);
52      }
53  
54  
55      protected void _testEntry(int i) throws Exception {
56          List items = getCachedSyndFeed().getEntries();
57          SyndEntry entry = (SyndEntry) items.get(i);
58          assertProperty(entry.getTitle(),"feed.entry["+i+"].title");
59          assertEquals(entry.getLink(),"http://example.com/blog/entry" + (i + 1));
60          assertProperty(entry.getAuthor(),"feed.entry["+i+"].author.name");
61          Date d = DateParser.parseW3CDateTime("2000-0"+(i+1)+"-01T01:00:00Z");
62          assertEquals(entry.getPublishedDate(),d);
63          assertProperty(entry.getDescription().getValue(),"feed.entry["+i+"].summary");
64          assertProperty(((SyndContent)entry.getContents().get(0)).getValue(),"feed.entry["+i+"].content[0]");
65      }
66  
67      public void testEntry0() throws Exception {
68          _testEntry(0);
69      }
70  
71      public void testEntry1() throws Exception {
72          _testEntry(1);
73      }
74  }