dlr 02/02/18 14:11:36
Modified: src/test/org/apache/xmlrpc XmlRpcTest.java
Log:
Got unit test for XmlWriter working.
Revision Changes Path
1.2 +15 -10 xml-rpc/src/test/org/apache/xmlrpc/XmlRpcTest.java
Index: XmlRpcTest.java
===================================================================
RCS file: /home/cvs/xml-rpc/src/test/org/apache/xmlrpc/XmlRpcTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -u -r1.1 -r1.2
--- XmlRpcTest.java 18 Feb 2002 21:28:42 -0000 1.1
+++ XmlRpcTest.java 18 Feb 2002 22:11:36 -0000 1.2
@@ -66,11 +66,13 @@
* Tests XmlRpc.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
- * @version $Id: XmlRpcTest.java,v 1.1 2002/02/18 21:28:42 dlr Exp $
+ * @version $Id: XmlRpcTest.java,v 1.2 2002/02/18 22:11:36 dlr Exp $
*/
public class XmlRpcTest
extends TestCase
{
+ private XmlRpcExtension xmlRpc;
+
/**
* Constructor
*/
@@ -92,7 +94,8 @@
*/
public void setUp()
{
- // Nothing done here yet.
+ XmlRpc.setDebug(true);
+ xmlRpc = new XmlRpcExtension();
}
/**
@@ -100,7 +103,8 @@
*/
public void tearDown()
{
- // Nothing to do here yet.
+ xmlRpc = null;
+ XmlRpc.setDebug(false);
}
/**
@@ -110,9 +114,6 @@
{
try
{
- XmlRpc.setDebug(true);
-
- XmlRpcExtension xmlRpc = new XmlRpcExtension();
// Test the XmlWriter
xmlRpc.testWriter();
@@ -125,7 +126,7 @@
}
}
- class XmlRpcExtension
+ private class XmlRpcExtension
extends XmlRpc
{
/**
@@ -143,11 +144,15 @@
assertEquals(XmlRpc.encoding, writer.getEncoding());
String foobar = "foobar";
writer.writeObject(foobar);
- assertEquals(foobar, buffer.toString());
+ writer.flush();
+ //System.err.println("buffer=" + new String(buffer.toByteArray()));
+ String postProlog = "<value>" + foobar + "</value>";
+ assertTrue(buffer.toString().endsWith(postProlog));
int thirtySeven = 37;
writer.writeObject(new Integer(37));
- assertEquals(foobar + "<int>" + thirtySeven + "</int>",
- buffer.toString());
+ writer.flush();
+ postProlog += "<value><int>" + thirtySeven + "</int></value>";
+ assertTrue(buffer.toString().endsWith(postProlog));
}
}
}