Methods Summary |
---|
protected void | setUp()
super.setUp();
arbXML = new ArbitraryGOMXml(name);
|
protected void | tearDown()
super.tearDown();
|
public void | testArbitraryGOMXml()
try {
new ArbitraryGOMXml(null);
fail("qname is null");
} catch (IllegalArgumentException e) {
}
ArbitraryGOMXml xml = new ArbitraryGOMXml(name);
assertEquals(name, xml.getQname());
assertEquals(name.getLocalPart(), xml.getLocalName());
|
public void | testGetChildParser()
try {
this.arbXML.getChildParser(null);
fail("qname is null");
} catch (GDataParseException e) {
assertEquals(0, this.arbXML.getChildren().size());
}
AtomParser childParser = this.arbXML.getChildParser(this.name);
assertTrue(childParser instanceof ArbitraryGOMXml);
assertEquals(name, ((ArbitraryGOMXml) childParser).getQname());
assertEquals(name.getLocalPart(), ((ArbitraryGOMXml) childParser)
.getLocalName());
assertEquals(1, this.arbXML.getChildren().size());
|
public void | testProcessAttribute()
try {
this.arbXML.processAttribute(null, "test");
fail("qname is null");
} catch (GDataParseException e) {
assertTrue(this.arbXML.getAttributes().size() == 0);
}
this.arbXML.processAttribute(name, "testme");
{
List<GOMAttribute> attributes = this.arbXML.getAttributes();
assertTrue(attributes.size() == 1);
GOMAttribute attribute = attributes.get(0);
assertNotNull(attribute);
assertEquals(name, attribute.getQname());
assertEquals(name.getLocalPart(), attribute.getLocalName());
assertEquals("testme", attribute.getTextValue());
}
{
this.arbXML.processAttribute(name, null);
List<GOMAttribute> attributes = this.arbXML.getAttributes();
assertTrue(attributes.size() == 2);
GOMAttribute attribute = attributes.get(1);
assertNotNull(attribute);
assertEquals(name, attribute.getQname());
assertEquals(name.getLocalPart(), attribute.getLocalName());
assertEquals("", attribute.getTextValue());
}
|
public void | testProcessElementValue()
try {
this.arbXML.processElementValue(null);
fail("name is null");
} catch (GDataParseException e) {
//
}
this.arbXML.processElementValue("test value");
try {
this.arbXML.processElementValue("test value");
fail("value is already set");
} catch (GDataParseException e) {
//
}
assertEquals("test value", this.arbXML.getTextValue());
|
public void | testWriteAtomOutput()
{
StringWriter writer = new StringWriter();
GOMOutputWriter w = new GOMStaxWriter(writer);
this.arbXML.writeAtomOutput(w);
assertNotNull(w.toString());
assertEquals("<" + this.name.getLocalPart() + "/>", writer
.toString());
}
try {
this.arbXML.writeAtomOutput(null);
fail("writer is null");
} catch (NullPointerException e) {
//
}
{
this.arbXML.processAttribute(name, "testme1");
this.arbXML.processElementValue("testme2");
StringWriter writer = new StringWriter();
GOMOutputWriter w = new GOMStaxWriter(writer);
this.arbXML.writeAtomOutput(w);
assertEquals("<" + this.name.getLocalPart()
+ " testme=\"testme1\">" + "testme2" + "</"
+ this.name.getLocalPart() + ">", writer.toString());
}
|