You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rd...@apache.org on 2003/07/09 20:10:24 UTC
cvs commit: jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/io TestSAXBeanWriter.java
rdonkin 2003/07/09 11:10:24
Modified: betwixt/src/test/org/apache/commons/betwixt/io
TestSAXBeanWriter.java
Log:
Improved unit tests
Revision Changes Path
1.5 +19 -10 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/io/TestSAXBeanWriter.java
Index: TestSAXBeanWriter.java
===================================================================
RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/io/TestSAXBeanWriter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestSAXBeanWriter.java 17 Feb 2003 19:41:57 -0000 1.4
+++ TestSAXBeanWriter.java 9 Jul 2003 18:10:24 -0000 1.5
@@ -72,6 +72,7 @@
import junit.textui.TestRunner;
import org.apache.commons.betwixt.PersonBean;
+import org.apache.commons.betwixt.AbstractTestCase;
import org.apache.commons.logging.impl.SimpleLog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -88,7 +89,7 @@
* @author <a href="mailto:martin@mvdb.net">Martin van den Bemt</a>
* @version $Id$
*/
-public class TestSAXBeanWriter extends TestCase {
+public class TestSAXBeanWriter extends AbstractTestCase {
public static final String XML = "<?xml version='1.0'?><PersonBean id='1'><age>35</age><name>John Smith</name></PersonBean>";
@@ -102,14 +103,22 @@
// writer bean into string
StringWriter out = new StringWriter();
- SimpleLog log = new SimpleLog("[TestWrite:SAXBeanWriter]");
- log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
+ //SimpleLog log = new SimpleLog("[TestWrite:SAXBeanWriter]");
+ //log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
SAXBeanWriter writer = new SAXBeanWriter(new SAXContentHandler(out));
- writer.setLog(log);
+ //writer.setLog(log);
writer.write(bean);
String beanString = out.getBuffer().toString();
- System.out.println(beanString);
+ String xml = "<?xml version='1.0'?><PersonBean><age>35</age>"
+ + "<name>John Smith</name></PersonBean>";
+
+
+ xmlAssertIsomorphicContent(
+ parseString(xml),
+ parseString(beanString),
+ true);
+
// test the result
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org