#189 setUserPrincipal


For WebRequest and ServletUnitHttpRequest objects define the UserPrincipal field and allow them to be set by JUnit tests. I have several tests where I need to set a mock UserPrincipal object in order to test user specific code. Without the ability to set the UserPrincipal field in the WebRequest object I can't inject different users for different tests. This makes the testing framework practically useless to me for these servlets.


  • Wolfgang Fahl

    Wolfgang Fahl - 2012-09-13

    Dear Shawn,

    Thank you for your bugreport. I have put it into the feature request category and would kindly ask you to supply a testcase and may be patch according to the httpunit developerslist faq.
    If you have any questions please contact me via the developers mailing list.
    Thank you for your cooperation and keep up the good work!


  • Wolfgang Fahl

    Wolfgang Fahl - 2012-09-13

    Dear httpunit user!

    Thank you for your bug report. We appreciate the time and effort you are putting into this.

    Please supply a testcase with the expected result for the bug report that you are asking a solution for and we'll look into implementing it. For a start you might want to get the trunk version from the subversion repository (see https://sourceforge.net/svn/?group_id=6550\)
    and have a look at the source code of some of the more than 700 JUnit based testcase in there.

    If you do not use or have subversion tool you can still directly browse our test cases via:
    Looking into one or more of the Junit Java source files
    should give you a clue on what a proper testcase for httpunit looks like, often you will probably only have to "clone" an existing testcase and modify it slightly to your needs.

    When you are ready you might want to attach the testcase (and if you already have started implementing a solution for it it also the actual code) to the patch section of the sourceforge.net tracker for patches of the httpunit project at

    The main communication about further details of the development is via the httpunit developer mailinglist. You are most welcome to sign up via

    The httpunit developer team

    (Russell, Wolfgang, Mark, Patrick and Tim as of 2008-04)

  • Wolfgang Fahl

    Wolfgang Fahl - 2012-09-13
    • assigned_to: nobody --> wolfgang_fahl

Log in to post a comment.