1 5 package com.sun.syndication.unittest; 6 7 import com.sun.syndication.feed.synd.SyndCategory; 8 import com.sun.syndication.feed.synd.SyndEntry; 9 10 import java.util.List ; 11 import java.util.Set ; 12 import java.util.HashSet ; 13 14 18 public class TestSyndFeedRSS092 extends TestSyndFeedRSS091N { 19 20 public TestSyndFeedRSS092() { 21 super("rss_0.92"); 22 } 23 24 protected TestSyndFeedRSS092(String type) { 25 super(type); 26 } 27 28 protected TestSyndFeedRSS092(String feedType,String feedFileName) { 29 super(feedType,feedFileName); 30 } 31 32 protected void _testItem(int i) throws Exception { 33 super._testItem(i); 34 List items = getCachedSyndFeed().getEntries(); 35 SyndEntry entry = (SyndEntry) items.get(i); 36 37 assertProperty(entry.getTitle(),"channel.item["+i+"].title"); 38 assertProperty(entry.getLink(),"channel.item["+i+"].link"); 39 assertProperty(entry.getDescription().getValue(),"channel.item["+i+"].description"); 40 _testCategories(entry.getCategories(),"channel.item["+i+"]"); 41 } 42 43 protected void _testCategories(List cats,String prefix) throws Exception { 44 Set s1 = new HashSet (); 45 Set s2 = new HashSet (); 46 for (int i=0;i<cats.size();i++) { 47 SyndCategory cat = (SyndCategory) cats.get(i); 48 s1.add(cat.getTaxonomyUri()+" "+cat.getName()); 49 s2.add(getPrefix() + "." +prefix+".category["+i+"]^domain"+" "+getPrefix() + "." +prefix+".category["+i+"]"); 50 } 51 assertTrue(s1.equals(s2)); 52 } 53 54 } 55 | Popular Tags |