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

GOMAuthorImplTest

public class GOMAuthorImplTest extends TestCase
author
Simon Willnauer

Fields Summary
Constructors Summary
Methods Summary
public voidtestWriteRssOutput()

		GOMAuthorImpl impl = new GOMAuthorImpl();
		try {
			impl.writeRssOutput(null);
			fail("writer is null");
		} catch (GDataParseException e) {
		}
		StringWriter writer2 = new StringWriter();

		GOMOutputWriter writer = new GOMStaxWriter(writer2);
		impl.writeRssOutput(writer, "test");
		writer.flush();
		writer2.flush();

		assertEquals("<test></test>", writer2.toString());
		impl.setEmail("simonw@apache.org");
		impl.setUri("someuri");
		writer.close();

		writer2 = new StringWriter();
		writer = new GOMStaxWriter(writer2);
		impl.writeRssOutput(writer);
		writer.flush();
		writer2.flush();
		assertTrue(writer2.toString().length() > 0);

		assertEquals("<" + GOMAuthor.LOCALNAME + ">" + impl.getEmail() + "</"
				+ GOMAuthor.LOCALNAME + ">", writer2.toString());

		writer.close();

		impl.setName("simonw");
		writer2 = new StringWriter();
		writer = new GOMStaxWriter(writer2);
		impl.writeRssOutput(writer);
		writer.flush();
		writer2.flush();
		assertTrue(writer2.toString().length() > 0);

		assertEquals("<" + GOMAuthor.LOCALNAME + ">" + impl.getEmail() + "("
				+ impl.getName() + ")</" + GOMAuthor.LOCALNAME + ">", writer2
				.toString());