Menu

Testing with a custom ActionMapping class

Anonymous
2002-02-25
2002-02-26
  • Anonymous

    Anonymous - 2002-02-25

    I am still a little new to Struts and Struts TestCase so I apologize if there is an obvious answer to my question.  I am attempting to write some tests where we are using a custom ActionMapping class, it of course extends ActionMapping.  I am giving the ActionServlet an init parameter with the name of the custom mapping class in the web.xml.  I keep getting a ClassCastException because the custom class is not being used when I run my test.  Does Struts TestCase make use of the web.xml at all?  Is there a way to set the mapping class to use programmatically?  I am trying to get all of this to run inside of VAJ, which tend to present new challenges along the way.  I have managed to get the examples to run.  Any help would be greatly appreciated.  FYI - I am running with Struts TestCase 1.5 if it makes a difference.

     
    • Anonymous

      Anonymous - 2002-02-26

      I got around my problem by over-riding the the setUp() method in MockStrutsTestCase if anyone else was having a similar problem. I added config.setInitParameter("mapping", "customClass");

       
    • Deryl Seale

      Deryl Seale - 2002-02-26

      If you are using MockStrutsTestCase, then it is,
      in fact, ignoring the web.xml file at this point.
      For the next release, I will be adding support in
      that class for grabbing the actual web.xml file
      for parsing.

      Sorry for the trouble!

      -d.

       

Log in to post a comment.