You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ke...@sunlife.com on 2002/11/14 18:16:48 UTC

still a problem: RE: StrutsTestCase + overriding setUp without calling super.setUp() ERROR



On Thu, 2002-11-14 at 10:38, Maarten Volders wrote:
> Still the same problem here, he's still complaining that i'm overriding
> setUp() but that I have to implement super.setUp(), but you can see
> clearly in my code that I implement that method.
>
> Anyone with other suggestions??? I'm using Intellij 3.0 to run my unit
> test, but al my other unit tests run fine with it so I don't see the
> problem here.
>
>     public void setUp() {
>         try {
>             super.setUp(); // !!!!!!!!!!!
>         } catch(Exception e) {}
>     }
>
>     public SearchXtantActionTest(String testName) {
>         super(testName);
>         setConfigFile("E:/CBB/xml/web/UI");
>     }


Rewrite it like:

     public void setUp() {
         try {
             super.setUp(); // !!!!!!!!!!!
             setConfigFile("E:/CBB/xml/web/UI");
         } catch(Exception e) {}
     }

     public SearchXtantActionTest(String testName) {
         super(testName);
     }


The reason you're getting the exception is that you're trying to set the
config file in the constructor - which is called before setUp has been
called. You cant set the config file (or do anything really) until after
super.setUp() has been called.



<AndNowForSomethingCompletelyDifferent>

While we're talking about it, I've been thinking of submitting a patch to
StrutsTestCase to allow you to override having the Struts environment reset
between test methods. I'm pretty sure I could make the change in just one
or two classes. This is really against the JUnit philosophy - but it would
be really useful and convenient. Would anyone else support this?

</AndNowForSomethingCompletelyDifferent>

Best of luck,

Kevin

http://www.strutskickstart.com









---------------------------------------------------------------------------
This e-mail message (including attachments, if any) is intended for the use
of the individual or entity to which it is addressed and may contain
information that is privileged, proprietary , confidential and exempt from
disclosure.  If you are not the intended recipient, you are notified that
any dissemination, distribution or copying of this communication is
strictly prohibited.  If you have received this communication in error,
please notify the sender and erase this e-mail message immediately.
---------------------------------------------------------------------------



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: still a problem: RE: StrutsTestCase + overriding setUp without calling super.setUp() ERROR

Posted by Chris Winters <cw...@optiron.com>.
On Thu, 2002-11-14 at 12:16, Kevin.Bedell@sunlife.com wrote:
> <AndNowForSomethingCompletelyDifferent>
> While we're talking about it, I've been thinking of submitting a patch to
> StrutsTestCase to allow you to override having the Struts environment reset
> between test methods. I'm pretty sure I could make the change in just one
> or two classes. This is really against the JUnit philosophy - but it would
> be really useful and convenient. Would anyone else support this?
> </AndNowForSomethingCompletelyDifferent>

I'd dig it.

Chris

-- 
Chris Winters (cwinters@optiron.com)
Java Developer


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>