01: /*
02: * Created on Jun 24, 2004
03: *
04: */
05: package com.sun.syndication.unittest;
06:
07: import com.sun.syndication.feed.synd.SyndEntry;
08: import com.sun.syndication.feed.synd.SyndContent;
09: import com.sun.syndication.io.impl.DateParser;
10:
11: import java.util.List;
12: import java.util.Date;
13:
14: /**
15: * @author pat
16: *
17: */
18: public class TestSyndFeedAtom03 extends SyndFeedTest {
19:
20: public TestSyndFeedAtom03() {
21: super ("atom_0.3");
22: }
23:
24: protected TestSyndFeedAtom03(String type) {
25: super (type);
26: }
27:
28: protected TestSyndFeedAtom03(String feedType, String feedFileName) {
29: super (feedType, feedFileName);
30: }
31:
32: public void testTitle() throws Exception {
33: assertProperty(getCachedSyndFeed().getTitle(), "feed.title");
34: }
35:
36: public void testLink() throws Exception {
37: assertProperty(getCachedSyndFeed().getLink(), "feed.link^href");
38: }
39:
40: public void getAuthor() throws Exception {
41: assertProperty(getCachedSyndFeed().getAuthor(),
42: "feed.author.name");
43: }
44:
45: public void testCopyright() throws Exception {
46: assertProperty(getCachedSyndFeed().getCopyright(),
47: "feed.copyright");
48: }
49:
50: public void testPublishedDate() throws Exception {
51: Date d = DateParser.parseW3CDateTime("2000-01-01T00:00:00Z");
52: assertEquals(getCachedSyndFeed().getPublishedDate(), d);
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: assertProperty(entry.getLink(), "feed.entry[" + i
60: + "].link^href");
61: assertProperty(entry.getAuthor(), "feed.entry[" + i
62: + "].author.name");
63: Date d = DateParser.parseW3CDateTime("2000-0" + (i + 1)
64: + "-01T00:00:00Z");
65: assertEquals(entry.getPublishedDate(), d);
66: assertProperty(entry.getDescription().getValue(), "feed.entry["
67: + i + "].summary");
68: assertProperty(((SyndContent) entry.getContents().get(0))
69: .getValue(), "feed.entry[" + i + "].content[0]");
70: assertProperty(((SyndContent) entry.getContents().get(1))
71: .getValue(), "feed.entry[" + i + "].content[1]");
72: }
73:
74: public void testEntry0() throws Exception {
75: _testEntry(0);
76: }
77:
78: public void testEntry1() throws Exception {
79: _testEntry(1);
80: }
81:
82: }
|