Methods Summary |
---|
protected void | setUp()
this.cat = new GOMCategoryImpl();
|
protected void | tearDown()
super.tearDown();
|
public void | testProcessAttribute()
try {
this.cat.processAttribute(null, "test");
fail("qname is null");
} catch (GDataParseException e) {
//
}
{
QName name = new QName("term");
this.cat.processAttribute(name, "helloworld");
assertEquals("helloworld", this.cat.getTerm());
try {
this.cat.processAttribute(name, "helloworld");
fail("duplicated attribute");
} catch (GDataParseException e) {
//
}
}
{
QName name = new QName("scheme");
this.cat.processAttribute(name, "helloworld1");
assertEquals("helloworld1", this.cat.getScheme());
try {
this.cat.processAttribute(name, "helloworld1");
fail("duplicated attribute");
} catch (GDataParseException e) {
//
}
}
{
QName name = new QName("label");
this.cat.processAttribute(name, "John Cleese");
assertEquals("John Cleese", this.cat.getLabel());
try {
this.cat.processAttribute(name, "John Cleese");
fail("duplicated attribute");
} catch (GDataParseException e) {
//
}
}
|
public void | testProcessElementValue()
try {
this.cat.processElementValue(null);
fail("element value is null");
} catch (GDataParseException e) {
//
}
try {
this.cat.processElementValue("and again");
fail("can't contain a text value");
} catch (GDataParseException e) {
//
assertNull(this.cat.getTextValue());
}
|
public void | testProcessEndElement()
try {
this.cat.processEndElement();
fail("term is not set");
} catch (GDataParseException e) {
//
}
this.cat.setTerm("my Term");
this.cat.processEndElement();
this.cat.setScheme("test");
try {
this.cat.processEndElement();
fail("scheme is not a absoulte uri");
} catch (GDataParseException e) {
//
}
this.cat.setScheme("/test");
try {
this.cat.processEndElement();
fail("scheme is not a absoulte uri and no xmlbase is set");
} catch (GDataParseException e) {
//
}
{
this.cat.xmlBase = "http://www.apache.org";
this.cat.processEndElement();
}
{
this.cat.xmlBase = null;
this.cat.setScheme("http://www.apache.org/test");
this.cat.processEndElement();
}
|
public void | testWriteAtomOutput()
try {
this.cat.writeAtomOutput(null);
fail("wirter is null");
} catch (NullPointerException e) {
//
}
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.cat.writeAtomOutput(writer);
assertEquals("<category term=\"\"/>", strWriter.toString());
}
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.cat.term = "test";
this.cat.writeAtomOutput(writer);
assertEquals("<category term=\"test\"/>", strWriter.toString());
}
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.cat.label = "python";
this.cat.scheme = "monty";
this.cat.writeAtomOutput(writer);
assertEquals(
"<category term=\"test\" scheme=\"monty\" label=\"python\"/>",
strWriter.toString());
}
|
public void | testWriteRssOutput()
try {
this.cat.writeRssOutput(null);
fail("wirter is null");
} catch (NullPointerException e) {
//
}
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.cat.writeRssOutput(writer);
assertEquals("<category domain=\"\"/>", strWriter.toString());
}
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.cat.scheme = "www.apache.org";
this.cat.writeRssOutput(writer);
assertEquals("<category domain=\"www.apache.org\"/>", strWriter
.toString());
}
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.cat.scheme = "www.apache.org";
this.cat.term = "Goo Data";
this.cat.writeRssOutput(writer);
assertEquals(
"<category domain=\"www.apache.org\">Goo Data</category>",
strWriter.toString());
}
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.cat.scheme = "www.apache.org";
this.cat.term = "Goo Data";
this.cat.label = "ignore";
this.cat.writeRssOutput(writer);
assertEquals(
"<category domain=\"www.apache.org\">Goo Data</category>",
strWriter.toString());
}
|