vmassol 01/08/29 06:25:23
Modified: cactus/src/sample/share/org/apache/commons/cactus/sample/unit
TestServletTestCase2.java
Log:
added test for new ServletContextWrapper.getLogs() method to assert logs generated
by calls to log() methods
Revision Changes Path
1.10 +21 -1
jakarta-commons/cactus/src/sample/share/org/apache/commons/cactus/sample/unit/TestServletTestCase2.java
Index: TestServletTestCase2.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/cactus/src/sample/share/org/apache/commons/cactus/sample/unit/TestServletTestCase2.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TestServletTestCase2.java 2001/08/24 16:23:19 1.9
+++ TestServletTestCase2.java 2001/08/29 13:25:23 1.10
@@ -63,6 +63,7 @@
import junit.framework.*;
import org.apache.commons.cactus.*;
+import org.apache.commons.cactus.server.*;
import org.apache.commons.cactus.util.*;
/**
@@ -76,7 +77,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
*
- * @version $Id: TestServletTestCase2.java,v 1.9 2001/08/24 16:23:19 vmassol Exp $
+ * @version $Id: TestServletTestCase2.java,v 1.10 2001/08/29 13:25:23 vmassol Exp $
*/
public class TestServletTestCase2 extends ServletTestCase
{
@@ -460,6 +461,25 @@
String result = theResponse.getText();
assert("Page not found, got [" + result + "]",
result.indexOf("Hello !") > 0);
+ }
+
+ //-------------------------------------------------------------------------
+
+ /**
+ * Verify that calls to <code>ServletContext.log()</code> methods can
+ * be retrieved and asserted.
+ */
+ public void testGetLogs()
+ {
+ String message = "some test log";
+ ServletContext context = config.getServletContext();
+
+ context.log(message);
+
+ Vector logs = ((ServletContextWrapper)context).getLogs();
+ assertEquals("Found more than one log message", logs.size(), 1);
+ assert("Cannot find expected log message : [" + message + "]",
+ logs.contains("some test log"));
}
}