1 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 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(),"feed.author.name"); 42 } 43 44 public void testCopyright() throws Exception { 45 assertProperty(getCachedSyndFeed().getCopyright(),"feed.copyright"); 46 } 47 48 public void testPublishedDate() throws Exception { 49 Date d = DateParser.parseW3CDateTime("2000-01-01T00:00:00Z"); 50 assertEquals(getCachedSyndFeed().getPublishedDate(),d); 51 } 52 53 54 protected void _testEntry(int i) throws Exception { 55 List items = getCachedSyndFeed().getEntries(); 56 SyndEntry entry = (SyndEntry) items.get(i); 57 assertProperty(entry.getTitle(),"feed.entry["+i+"].title"); 58 assertProperty(entry.getLink(),"feed.entry["+i+"].link^href"); 59 assertProperty(entry.getAuthor(),"feed.entry["+i+"].author.name"); 60 Date d = DateParser.parseW3CDateTime("2000-0"+(i+1)+"-01T00:00:00Z"); 61 assertEquals(entry.getPublishedDate(),d); 62 assertProperty(entry.getDescription().getValue(),"feed.entry["+i+"].summary"); 63 assertProperty(((SyndContent)entry.getContents().get(0)).getValue(),"feed.entry["+i+"].content[0]"); 64 assertProperty(((SyndContent)entry.getContents().get(1)).getValue(),"feed.entry["+i+"].content[1]"); 65 } 66 67 public void testEntry0() throws Exception { 68 _testEntry(0); 69 } 70 71 public void testEntry1() throws Exception { 72 _testEntry(1); 73 } 74 75 76 } 77 | Popular Tags |