Jersey Tests with Authentication

When I tested my REST-interface, which I implemented with Jersey, I also wanted to write Unit tests for an easy test. Since I spent some time to get authentication and autorisation working, I stood before another problem, when logging in and check access to my resources.

The problem that occured was that with each request a new session id was generated, which makes my authentication worthless. But I found a way around it:

So the secret is to save the cookie of the response and append it to each following request!

This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Jersey Tests with Authentication

  1. Aslam says:

    Excellent. It worked out. Thumbs up.

Leave a Reply to Aslam Cancel reply

Your email address will not be published. Required fields are marked *


seven − 6 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">