jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicholas Lesiecki" <n...@eblox.com>
Subject RE: new user - problems with latest nightly build
Date Sat, 20 Apr 2002 00:31:28 GMT
Robert,

It looks like you are using the example from the book, which was designed
with 1.1/1.2 in mind with Cactus 1.3 (the nightly build).

The old begin signature was:
public void beginDoGet(ServletTestRequest request) {

the new one would be:
public void beginDoGet(WebTestRequest request) {

This would cause the java.lang.IllegalArgumentException: argument type
mismatch that you are seeing.

Try switching to the new signature and see if that works for you.

Cheers,

Nicholas Lesiecki

-----Original Message-----
From: Robert Koberg [mailto:rob@koberg.com]
Sent: Friday, April 19, 2002 4:03 PM
To: cactus-user@jakarta.apache.org
Subject: new user - problems with latest nightly build

Hi,

It is taking me a while to get going with Cactus :( I am trying to get
the an example in _Java Tools for Extreme Programming_ (Writing Cactus
Tests starting on page 227).

I have been searching for answers in the archives, but have not found
anything similar. I have taken the properties posted by Vincent Massol
for  log4j-1.2beta4.jar
(http://www.mail-archive.com/cactus-user%40jakarta.apache.org/msg01536.html)
.
I get the following error (test case is below - hitting the servlet
alone returns the expected result):

$ java com.livestoryboard.MapperServletTest
.E
Time: 0.047
There was 1 error:
1) testDoGet(com.livestoryboard.MapperServletTest)
java.lang.IllegalArgumentException: argument type mismatch
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:42)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:28)
        at
org.apache.cactus.AbstractTestCase.callBeginMethod(AbstractTestCase.j
ava:227)
        at
org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase.ja
va:433)
        at
org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:133)
        at
org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:400)

        at
com.livestoryboard.MapperServletTest.main(MapperServletTest.java:49)

FAILURES!!!
Tests run: 1,  Failures: 0,  Errors: 1


// MapperServletTest.java
package com.livestoryboard;

import org.apache.cactus.*;
import junit.framework.*;

public class MapperServletTest extends ServletTestCase {

    private MapperServlet servlet;

    public MapperServletTest(String name) {
        super(name);
    }

    public void beginDoGet(ServletTestRequest request) {
        request.addParameter("foo", "manchu");
    }

    public void setUp() throws Exception {
        this.config.setInitParameter("ALL_CAPS", "true");
        servlet = new MapperServlet();
        servlet.init(config);
    }

    public void testDoGet() throws Exception {
        servlet.doGet(request, response);
        String value = (String)session.getAttribute("foo");
        assertEquals("request param not mapped into session", "manchu",
value);
    }

    public void tearDown() {}

    //public void testUseAllCaps() {
        //assertTrue("servlet set to use all cpas", servletUseAllCaps());
    //}

    public void endDoGet(WebResponse respons) {
        String responseString = respons.getText();
        System.out.println(responseString);
        boolean paramInResponse = responseString.indexOf("FOO=MANCHU") > -1;
        assertTrue("param not foound in response", paramInResponse);
    }

    public static TestSuite suite() {
        TestSuite suite = new TestSuite(MapperServletTest.class);
        return suite;
    }

    public static void main(String[] args) {
        junit.textui.TestRunner.run(suite());
    }

}




--
To unsubscribe, e-mail:
<mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:cactus-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>


Mime
View raw message