### Question:
SyndEntryDocumentSource implements SyndEntrySource { @Override public void source(SyndEntry entry, Object obj, Map<String, Object> params, XWikiContext context) throws XWikiException { Document doc = castDocument(obj, context); if (!doc.hasAccessLevel("view")) { throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS, XWikiException.ERROR_XWIKI_ACCESS_DENIED, "Access denied in view mode!"); } Map<String, Object> trueParams = joinParams(params, getParams()); sourceDocument(entry, doc, trueParams, context); } SyndEntryDocumentSource();  SyndEntryDocumentSource(Map<String, Object> params); Map<String, Object> getParams(); void setParams(Map<String, Object> params); @Override void source(SyndEntry entry, Object obj, Map<String, Object> params, XWikiContext context); void sourceDocument(SyndEntry entry, Document doc, Map<String, Object> params, XWikiContext context); static org.w3c.dom.Document tidy(String xmlFragment, Properties config); static int innerTextLength(Node node); static String getXMLPreview(String xmlFragment, int previewLength); static String getHTMLPreview(String htmlFragment, int previewLength); static String getPlainPreview(String plainText, int previewLength); static final String CONTENT_TYPE; static final String CONTENT_LENGTH; static final Properties TIDY_FEED_CONFIG; static final Properties TIDY_XML_CONFIG; static final Properties TIDY_HTML_CONFIG; static final String FIELD_URI; static final String FIELD_LINK; static final String FIELD_TITLE; static final String FIELD_DESCRIPTION; static final String FIELD_CATEGORIES; static final String FIELD_PUBLISHED_DATE; static final String FIELD_UPDATED_DATE; static final String FIELD_AUTHOR; static final String FIELD_CONTRIBUTORS; static final Map<String, Object> DEFAULT_PARAMS; }### Answer:
@Test public void testSourceConsistency() { assertEquals(source(this.doc), source(this.doc), INCONSISTENCY); }
@Test public void testSourcePolymorphism() { SyndEntryImpl fromXDoc = source(this.doc); SyndEntryImpl fromDoc = source(this.doc.newDocument(this.oldcore.getXWikiContext())); SyndEntryImpl fromFullName = source(this.doc.getFullName()); assertEquals(fromXDoc, fromDoc, POLYMORPHISM_INCONSISTENCY); assertEquals(fromXDoc, fromFullName, POLYMORPHISM_INCONSISTENCY); assertEquals(fromDoc, fromFullName, POLYMORPHISM_INCONSISTENCY); }
@Test public void testSourceAccessRights() throws XWikiException { this.oldcore.getXWikiContext().setUser("XWiki.Albatross"); try { this.source.source(new SyndEntryImpl(), doc, Collections.EMPTY_MAP, this.oldcore.getXWikiContext()); fail(ACCESS_RIGHTS_VIOLATED); } catch (XWikiException expected) { assertEquals(XWikiException.ERROR_XWIKI_ACCESS_DENIED, expected.getCode()); } this.oldcore.getXWikiContext().setUser("Condor"); this.source.source(new SyndEntryImpl(), doc, Collections.EMPTY_MAP, this.oldcore.getXWikiContext()); }