-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

All,

I'm having trouble understanding the behavior of a unit test I'm writing
against TC 7.0.x trunk to prepare for testing a patch. I happen to be
working in org/apache/catalina/connector/TestRequest.java and my test
method contains the following code:

        // set up my test

        System.out.println("Checking assertions");
        assertTrue("Non-200 response for POST request",
                   client.isResponse200());
        assertEquals("Incorrect response for POST request",
                     "foo=bar,bar=baz",
                     client.getResponseBody());

        System.out.println("Looking good so far!");

I get this output when running the test:

    [lots of output from other tests, setup messages, etc]

    [junit] ===== INFO ======
    [junit] Response: HTTP/1.1 200 OK
    [junit] Headers: [Server: Apache-Coyote/1.1, Content-Type:
text/plain;charset=UTF-8, Content-Length: 7, Date: Wed, 03 Nov 2010
12:57:46 GMT, Connection: close]
    [junit] Response body: foo=bar
    [junit] Checking assertions
    [junit] Nov 3, 2010 8:57:47 AM
org.apache.coyote.http11.AbstractHttp11Protocol pause
    [junit] INFO: Pausing Coyote HTTP/1.1 on http-8006

    [lots more shutdown messages]

I'm confused as to why I'm not getting an AssertionError thrown from
this method, as I'm expecting client.getRequestBody() to return
"foo=bar,bar=baz" but I'm getting only "foo=bar". I never see the
message "Looking good so far!" so I suspect that the assertion is
actually failing, but it looks like it's being swallowed somewhere.

I have no try/catch blocks in my unit test method, and it looks like I'm
using the assert methods in the same way as other tests in the same file.

Can anyone offer any suggestions or pointers?

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzRXucACgkQ9CaO5/Lv0PBbEQCgu8rdDthqYI5FgZFUIIoEx/kq
8DQAn1F3ikT7YHAEHvUv3jpPYUCjL4oa
=7ujU
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to