public void testWriteRssOutput() throws XMLStreamException {
{
this.titleImpl.contentType = ContentType.TEXT;
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.titleImpl.writeRssOutput(writer);
assertEquals("<title/>", strWriter.toString());
}
{
this.titleImpl.setTextValue("><hello world");
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.titleImpl.writeRssOutput(writer);
assertEquals("<title>><hello world</title>", strWriter
.toString());
}
{
this.titleImpl.contentType = ContentType.HTML;
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.titleImpl.writeRssOutput(writer);
assertEquals("<title>><hello world</title>", strWriter
.toString());
}
{
this.titleImpl.contentType = ContentType.XHTML;
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.titleImpl.writeRssOutput(writer);
// no markup in rss
assertEquals("<title>><hello world</title>", strWriter
.toString());
}
{
this.titleImpl.contentType = ContentType.XHTML;
this.titleImpl.xmlBase = "http://www.apache.org";
this.titleImpl.xmlLang = "en";
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.titleImpl.writeRssOutput(writer);
// no markup in rss
assertEquals(
"<title xml:base=\"http://www.apache.org\" xml:lang=\"en\">><hello world</title>",
strWriter.toString());
}
{
this.subTitleImpl.contentType = ContentType.XHTML;
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.subTitleImpl.writeRssOutput(writer);
assertEquals("<description/>", strWriter.toString());
}
{
this.subTitleImpl.contentType = ContentType.XHTML;
this.subTitleImpl.setTextValue("><hello world");
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.subTitleImpl.writeRssOutput(writer);
assertEquals("<description>><hello world</description>",
strWriter.toString());
}