Methods Summary |
---|
protected void | setUp()
this.impl = new SimpleGOMElementImpl(localName,
GOMNamespace.ATOM_NAMESPACE);
|
public void | testProcessElementValue()
this.impl.processElementValue("myValue");
assertEquals("myValue", this.impl.getTextValue());
try {
this.impl.processElementValue("myValue");
fail("duplicated");
} catch (GDataParseException e) {
//
}
|
public void | testProcessEndElement()
// depends validator
this.impl.processEndElement();
this.impl
.setValidator(new GOMFeedImpl.PositiveIntegerValidator("test"));
try {
this.impl.processEndElement();
fail("value is null");
} catch (GDataParseException e) {
assertTrue(e.getMessage().indexOf("requires a element value") > 0);
}
this.impl.setTextValue("1");
this.impl.processEndElement();
|
public void | testSimpleGOMElementImpl()
try {
new SimpleGOMElementImpl(null, GOMNamespace.ATOM_NAMESPACE);
fail("localname is null");
} catch (IllegalArgumentException e) {
//
}
try {
new SimpleGOMElementImpl("test", null);
fail("namespace is null");
} catch (IllegalArgumentException e) {
//
}
SimpleGOMElementImpl impl2 = new SimpleGOMElementImpl(this.localName,
GOMNamespace.ATOM_NAMESPACE);
assertEquals(impl2.getQname().getNamespaceURI(),
GOMNamespace.ATOM_NS_URI);
assertEquals(impl2.getQname().getPrefix(), GOMNamespace.ATOM_NS_PREFIX);
assertEquals(impl2.getQname().getLocalPart(), this.localName);
assertEquals(impl2.getLocalName(), this.localName);
|
public void | testWriteAtomOutput()
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.impl.writeAtomOutput(writer);
assertEquals("<atom:" + this.localName + "/>", strWriter.toString());
}
{
StringWriter strWriter = new StringWriter();
GOMOutputWriter writer = new GOMStaxWriter(strWriter);
this.impl.setTextValue("hello world");
this.impl.writeAtomOutput(writer);
assertEquals("<atom:" + this.localName + ">hello world</atom:"
+ this.localName + ">", strWriter.toString());
}
|