Methods Summary |
---|
protected void | setUp()
this.updateImpl = new GOMUpdatedImpl();
this.publishImpl = new GOMPublishedImpl();
|
public void | testProcessElementValue()
try {
this.updateImpl.processElementValue(null);
fail("must not be null");
} catch (IllegalArgumentException e) {
//
}
try {
this.updateImpl.processElementValue("not a date");
fail("illegal string");
} catch (GDataParseException e) {
//
}
this.updateImpl.processElementValue(DATE);
assertNotNull(this.updateImpl.getDate());
this.updateImpl.processElementValue(DATE1);
assertNotNull(this.updateImpl.getDate());
|
public void | testProcessEndElement()
try {
this.updateImpl.processEndElement();
fail("no element value");
} catch (GDataParseException e) {
//
}
this.updateImpl.setDate(new Date());
this.updateImpl.processEndElement();
|
public void | testWriteAtomOutput()
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.updateImpl.writeAtomOutput(writer);
assertTrue(strWriter.toString().startsWith("<updated>"));
assertTrue(strWriter.toString().endsWith("</updated>"));
}
{
this.updateImpl.processElementValue(DATE);
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.updateImpl.writeAtomOutput(writer);
assertEquals("<updated>" + DATE + "</updated>", strWriter
.toString());
}
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.publishImpl.writeAtomOutput(writer);
assertTrue(strWriter.toString().startsWith("<published>"));
assertTrue(strWriter.toString().endsWith("</published>"));
}
{
this.publishImpl.processElementValue(DATE);
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.publishImpl.writeAtomOutput(writer);
assertEquals("<published>" + DATE + "</published>", strWriter
.toString());
}
|
public void | testWriteRssOutput()
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.updateImpl.writeRssOutput(writer);
assertTrue(strWriter.toString().startsWith("<atom:updated>"));
assertTrue(strWriter.toString().endsWith("</atom:updated>"));
}
{
this.updateImpl.processElementValue(DATE);
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.updateImpl.writeRssOutput(writer);
assertEquals("<atom:updated>" + DATE + "</atom:updated>", strWriter
.toString());
}
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.publishImpl.writeRssOutput(writer);
assertTrue(strWriter.toString().startsWith("<pubDate>"));
assertTrue(strWriter.toString().endsWith("</pubDate>"));
}
{
this.publishImpl.processElementValue(DATE);
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.publishImpl.writeRssOutput(writer);
assertEquals("<pubDate>" + DATE_RSS + "</pubDate>", strWriter
.toString());
}
|