FileDocCategorySizeDatePackage
GOMIdImplTest.javaAPI DocApache Lucene 2.1.03069Wed Feb 14 10:45:58 GMT 2007org.apache.lucene.gdata.gom.core

GOMIdImplTest

public class GOMIdImplTest extends TestCase
author
Simon Willnauer

Fields Summary
GOMIdImpl
impl
Constructors Summary
Methods Summary
protected voidsetUp()

		this.impl = new GOMIdImpl();
	
public voidtestProcessElementValue()

		this.impl.processElementValue("test");
		assertEquals("test", this.impl.getTextValue());
	
public voidtestProcessEndElement()

		try {
			this.impl.processEndElement();
			fail("not set");
		} catch (GDataParseException e) {
			// 
		}
		this.impl.setTextValue("testme");
		this.impl.processEndElement();

	
public voidtestWriteAtomOutput()

		{
			StringWriter stW = new StringWriter();
			GOMOutputWriter writer = new GOMStaxWriter(stW);
			this.impl.writeAtomOutput(writer);

			assertEquals("<id/>", stW.toString());
		}

		{
			this.impl.setTextValue("testme");
			StringWriter stW = new StringWriter();
			GOMOutputWriter writer = new GOMStaxWriter(stW);
			this.impl.writeAtomOutput(writer);

			assertEquals("<id>testme</id>", stW.toString());

		}

	
public voidtestWriteRssOutputGOMOutputWriter()

		{
			StringWriter stW = new StringWriter();
			GOMOutputWriter writer = new GOMStaxWriter(stW);
			this.impl.writeRssOutput(writer);

			assertEquals("<atom:id/>", stW.toString());
		}

		{
			this.impl.setTextValue("testme");
			StringWriter stW = new StringWriter();
			GOMOutputWriter writer = new GOMStaxWriter(stW);
			this.impl.writeRssOutput(writer);

			assertEquals("<atom:id>testme</atom:id>", stW.toString());

		}

		{
			this.impl.setTextValue("testme");
			StringWriter stW = new StringWriter();
			GOMOutputWriter writer = new GOMStaxWriter(stW);
			this.impl.writeRssOutput(writer, "guid");

			assertEquals("<guid>testme</guid>", stW.toString());

		}