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

GOMDocumentImplTest

public class GOMDocumentImplTest extends TestCase
author
Simon Willnauer

Fields Summary
Constructors Summary
Methods Summary
public voidtestWriteAtomOutput()

		GOMDocumentImpl<ArbitraryGOMXml> impl = new GOMDocumentImpl<ArbitraryGOMXml>();
		impl.setRootElement(new ArbitraryGOMXml(new QName("test")));
		{
			StringWriter strWriter = new StringWriter();
			GOMOutputWriter writer = new GOMStaxWriter(strWriter);
			impl.writeAtomOutput(writer);
			assertEquals("<?xml version='1.0' encoding='UTF-8'?><test/>",
					strWriter.toString());
		}
		impl.setRootElement(null);
		{
			StringWriter strWriter = new StringWriter();
			GOMOutputWriter writer = new GOMStaxWriter(strWriter);
			impl.writeAtomOutput(writer);
			assertEquals("<?xml version='1.0' encoding='UTF-8'?>", strWriter
					.toString());
		}

		impl.setVersion("2.0");
		impl.setCharacterEncoding("ISO-8859-1");
		{
			StringWriter strWriter = new StringWriter();
			GOMOutputWriter writer = new GOMStaxWriter(strWriter);
			impl.writeAtomOutput(writer);
			assertEquals("<?xml version='2.0' encoding='ISO-8859-1'?>",
					strWriter.toString());
		}
	
public voidtestWriteRssOutput()

		GOMDocumentImpl<ArbitraryGOMXml> impl = new GOMDocumentImpl<ArbitraryGOMXml>();
		impl.setRootElement(new ArbitraryGOMXml(new QName("test")));
		{
			StringWriter strWriter = new StringWriter();
			GOMOutputWriter writer = new GOMStaxWriter(strWriter);
			impl.writeRssOutput(writer);
			assertEquals("<?xml version='1.0' encoding='UTF-8'?><test/>",
					strWriter.toString());
		}
		impl.setRootElement(null);
		{
			StringWriter strWriter = new StringWriter();
			GOMOutputWriter writer = new GOMStaxWriter(strWriter);
			impl.writeRssOutput(writer);
			assertEquals("<?xml version='1.0' encoding='UTF-8'?>", strWriter
					.toString());
		}

		impl.setVersion("2.0");
		impl.setCharacterEncoding("ISO-8859-1");
		{
			StringWriter strWriter = new StringWriter();
			GOMOutputWriter writer = new GOMStaxWriter(strWriter);
			impl.writeRssOutput(writer);
			assertEquals("<?xml version='2.0' encoding='ISO-8859-1'?>",
					strWriter.toString());
		}