jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Javier Campoamor" <jcampoa...@lapize.com>
Subject RE: error invoking test method
Date Wed, 13 Feb 2002 16:09:12 GMT
Perhaps I'm wrong, but I think that the problem could be that you need to
copy the TestSimpleServlet class in the server side.





> -----Mensaje original-----
> De: Raffaella Coccioli [mailto:r.coccioli@libero.it]
> Enviado el: miƩrcoles 13 de febrero de 2002 15:15
> Para: Cactus Users List
> Asunto: error invoking test method
>
>
> The code of my test-class is:
>
> public class TestSimpleServlet extends ServletTestCase
> {
>
>
>      public TestSimpleServlet(String theName)
>     {
>
>         super(theName);
>
>     }
>
>
>
>     public static Test suite()
>     {
>
>          TestSuite suite = new TestSuite();
>
>           suite.addTest(new TestSimpleServlet("testRegisterUser"));
>           TestResult result=  new TestResult();
>           suite.run(result);
>           return suite;
>     }
>
>
>
> //[standard JUnit code. See the using section]
>     /**
>      * Sets the HTTP request parameter that will be available in the test
>      * method.
>  */
>     public void beginRegisterUser(ServletTestRequest theRequest)
>     {
>
>       theRequest.addParameter("USER_NAME", "RAFFA");
>
>     }
>
>     /**
>      * Unit test the registerUSer method.
>      */
>     public void testRegisterUser()
>     {
>         // Instantiate the class to test
>         SimpleServlet servlet = new SimpleServlet();
>
>
>         // Call the method to test
>         String name = servlet.registerUser(request, response);
>
>         // Verify that it returns the correct name
>         assertEquals("Raffa", name);
>
>         // Verify that the name has been put in the session
>         assertEquals("Raffa", (String)session.getValue("NAME"));
>     }
>
>
>
>
>
> When testRegisterUser method has invoked it produces the error:
>
> java.io.StreamCorruptedException: InputStream does not contain a
> serialized object
>  at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:849)
>  at java.io.ObjectInputStream.<init>(ObjectInputStream.java:168)
>  at
> org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpCli
> ent.java:148)
>  at
> org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase
> .java:422)
>  at org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
>  at org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
>
>
> Can anyone help me?
> Thanks in advance
>



--
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