Hi Folks,
I'm using cactus to test a few classes that are used by a servlet dealing
with HttpServletRequest and HttpServletResponse. Everything works
fine. This is when I love UnitTesting :).
I have a problem with the main Servlet containg the classes I mentioned
before and passing HttpServletRequest/HttpServletResponse. You know it's not
a big deal to write large servlet classes. Okay but the testcase I use to
test the facade servlet wont't work fine. I got the following exception.
Error calling [public static com.meterware.httpunit.WebResponse
com.meterware.httpunit.WebResponse.newResponse(java.net.URLConnection)
throws java.io.IOException]
org.apache.cactus.util.ChainedRuntimeException: Error calling [public static
com.meterware.httpunit.WebResponse
com.meterware.httpunit.WebResponse.newResponse(java.net.URLConnection)
throws java.io.IOException]
at
org.apache.cactus.AbstractTestCase.createHttpUnitWebResponse(AbstractTestCas
e.java:336)
at
org.apache.cactus.AbstractTestCase.callEndMethod(AbstractTestCase.java:267)
at
org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase.java:425)
at org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
at org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:131)
at junit.framework.TestSuite.runTest(TestSuite.java:173)
at junit.framework.TestSuite.run(TestSuite.java:168)
at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu
nner.java:231)
at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestR
unner.java:409)
java.lang.reflect.InvocationTargetException:
java.util.NoSuchElementException
at java.util.StringTokenizer.nextToken(StringTokenizer.java:235)
at
com.meterware.httpunit.HttpUnitUtils.parseContentTypeHeader(HttpUnitUtils.ja
va:36)
at
com.meterware.httpunit.WebResponse.readContentTypeHeader(WebResponse.java:54
3)
at com.meterware.httpunit.WebResponse.getContentType(WebResponse.java:132)
at com.meterware.httpunit.HttpWebResponse.<init>(HttpWebResponse.java:55)
at com.meterware.httpunit.WebResponse.newResponse(WebResponse.java:64)
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.cactus.AbstractTestCase.createHttpUnitWebResponse(AbstractTestCas
e.java:334)
at
org.apache.cactus.AbstractTestCase.callEndMethod(AbstractTestCase.java:267)
at
org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase.java:425)
at org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
at org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:131)
at junit.framework.TestSuite.runTest(TestSuite.java:173)
at junit.framework.TestSuite.run(TestSuite.java:168)
at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu
nner.java:231)
at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestR
unner.java:409)
Don't know what httpunit doesn't like. The ant taks I use looks like this:
<junit fork="yes" printsummary="yes">
<classpath>
<pathelement location="${destdir}"/>
<pathelement location="${basedir}/metadata/test"/>
<pathelement location="${libdir}/junit.jar"/>
<pathelement location="${libdir}/httpunit.jar"/>
<pathelement location="${libdir}/httpclient.jar"/>
<pathelement location="${libdir}/cactus.jar"/>
<pathelement location="${libdir}/log4j.jar"/>
<pathelement location="${libdir}/servlet.jar"/>
<pathelement location="${libdir}/gtwy.jar"/>
<pathelement location="${libdir}/jakarta-oro.jar"/>
<pathelement location="${libdir}/jaxp.jar"/>
<pathelement location="${libdir}/crimson.jar"/>
<pathelement location="${libdir}/dom4j-core.jar"/>
<pathelement location="${libdir}/jaxen.jar"/>
<pathelement location="${libdir}/saxpath.jar"/>
<pathelement location="${libdir}/gtwy.jar"/>
<pathelement location="${libdir}/msv.jar"/>
<pathelement location="${libdir}/isorelax.jar"/>
<pathelement location="${libdir}/relaxngDatatype.jar"/>
<pathelement location="${libdir}/log4j.jar"/>
<pathelement location="${libdir}/jakarta-oro.jar"/>
</classpath>
<formatter type="xml"/>
<test haltonfailure="no"
name="com.ceyoniq.healthcare.horus.commands.test.SplitterTest"
outfile="./reports/SplitterTest"/>
<test haltonfailure="no"
name="com.ceyoniq.healthcare.horus.commands.test.SessionTimeVerifierTest"
outfile="./reports/SessionTimeVerifierTest"/>
<test haltonfailure="no"
name="com.ceyoniq.healthcare.horus.commands.test.GatewayCommunicatorTest"
outfile="./reports/GatewayCommunicatorTest"/>
<test haltonfailure="no"
name="com.ceyoniq.healthcare.horus.commands.test.SimpleOutputManagerTest"
outfile="./reports/SimpleOutputManagerTest"/>
<test haltonfailure="no"
name="com.ceyoniq.healthcare.horus.test.RedirectorServantTest"
outfile="./reports/RedirectServantTest"/>
<test haltonfailure="no"
name="com.ceyoniq.healthcare.horus.test.ErrorJSPTest"
outfile="./reports/ErrorJSPTest"/>
<test haltonfailure="no"
name="com.ceyoniq.healthcare.horus.test.DocViewerServletTest"
outfile="./reports/DocViewerServletTest"/>
</junit>
Test 1 to 6 work fine but the last causes above mentioned error. Thax for
your help.
Bye
Toby
Mit freundlichen Gr��en
Best regards
Tobias Rademacher
----------------------------------------------------------------------------
------
SAP Beratung. Office, Outlook, Filesystem und Datenbank
Archivierung. Objektmanagementsysteme. Portalstrategie.
Content Lifecycle Management. DIN EN ISO 9001.
DIE NEUE CEYONIQ HEALTHCARE 15% Marktanteil seit
Unternehmensbestehen.
http:\\www.ceyoniq.com/healthcare
----------------------------------------------------------------------------
------
----------------------------------------------------------------------------
------
Tobias Rademacher
Software Development
CEYONIQ Healthcare Fon: +49 (0)821 44490-0
GmbH & Co. KG Fax: +49 (0)821 44490-60
Kurzes Gel�nd 6 mailto:[EMAIL PROTECTED]
86156 Augsburg www.ceyoniq.com/healthcare
Germany
----------------------------------------------------------------------------
-----------
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>